iOS - Terminated due to memory issue error










1















So i am doing a network calls to retrieve image and using that i am show a kind of a video.
After a while i can see the memory lose and energy impact:
enter image description here



after a while my app crushed and i got :"Terminated due to memory issue error"



Before that i got that error from the image caller method:"error from dataResponse:The operation couldn’t be completed. No space left on device"



This are the two method i use:



class InstallationViewController: BaseViewController {

func imageCaller(url: String , success: @escaping (UIImage) -> Void, failure: @escaping () -> Void)
let handler = AuthenticateHandler()
self.urlSession = URLSession(configuration: URLSessionConfiguration.default, delegate: handler, delegateQueue: OperationQueue.main)

self.imageThumbnailTask = urlSession?.dataTask(with: URL(string:url)!) data, res, err in

if err != nil
print("error from dataResponse:(err?.localizedDescription ?? "Response Error")")
failure()
return

DispatchQueue.main.async

if let imageData = data, let image = UIImage(data: imageData)
success(image)
URLCache.shared.removeAllCachedResponses()




self.imageThumbnailTask?.resume()


func imageThumbnailcall()
self.indicaotrTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.HandleOverTime), userInfo: nil, repeats: false)

self.imageCaller( url: self.isShowingThermal ? self.thermalUrl : self.visualUrl, success: (image) in

self.indicaotrTimer?.invalidate()

DispatchQueue.main.async
self.imageLoaderIndicator.stopAnimating()
self.backGroundImageView.image = image

if self.isInVC
self.imageThumbnailcall()

)
self.imageLoaderIndicator.stopAnimating()




Worth mentioning that this line:



 let handler = AuthenticateHandler()
self.urlSession = URLSession(configuration: URLSessionConfiguration.default, delegate: handler, delegateQueue: OperationQueue.main)


for digest protocol










share|improve this question




























    1















    So i am doing a network calls to retrieve image and using that i am show a kind of a video.
    After a while i can see the memory lose and energy impact:
    enter image description here



    after a while my app crushed and i got :"Terminated due to memory issue error"



    Before that i got that error from the image caller method:"error from dataResponse:The operation couldn’t be completed. No space left on device"



    This are the two method i use:



    class InstallationViewController: BaseViewController {

    func imageCaller(url: String , success: @escaping (UIImage) -> Void, failure: @escaping () -> Void)
    let handler = AuthenticateHandler()
    self.urlSession = URLSession(configuration: URLSessionConfiguration.default, delegate: handler, delegateQueue: OperationQueue.main)

    self.imageThumbnailTask = urlSession?.dataTask(with: URL(string:url)!) data, res, err in

    if err != nil
    print("error from dataResponse:(err?.localizedDescription ?? "Response Error")")
    failure()
    return

    DispatchQueue.main.async

    if let imageData = data, let image = UIImage(data: imageData)
    success(image)
    URLCache.shared.removeAllCachedResponses()




    self.imageThumbnailTask?.resume()


    func imageThumbnailcall()
    self.indicaotrTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.HandleOverTime), userInfo: nil, repeats: false)

    self.imageCaller( url: self.isShowingThermal ? self.thermalUrl : self.visualUrl, success: (image) in

    self.indicaotrTimer?.invalidate()

    DispatchQueue.main.async
    self.imageLoaderIndicator.stopAnimating()
    self.backGroundImageView.image = image

    if self.isInVC
    self.imageThumbnailcall()

    )
    self.imageLoaderIndicator.stopAnimating()




    Worth mentioning that this line:



     let handler = AuthenticateHandler()
    self.urlSession = URLSession(configuration: URLSessionConfiguration.default, delegate: handler, delegateQueue: OperationQueue.main)


    for digest protocol










    share|improve this question


























      1












      1








      1








      So i am doing a network calls to retrieve image and using that i am show a kind of a video.
      After a while i can see the memory lose and energy impact:
      enter image description here



      after a while my app crushed and i got :"Terminated due to memory issue error"



      Before that i got that error from the image caller method:"error from dataResponse:The operation couldn’t be completed. No space left on device"



      This are the two method i use:



      class InstallationViewController: BaseViewController {

      func imageCaller(url: String , success: @escaping (UIImage) -> Void, failure: @escaping () -> Void)
      let handler = AuthenticateHandler()
      self.urlSession = URLSession(configuration: URLSessionConfiguration.default, delegate: handler, delegateQueue: OperationQueue.main)

      self.imageThumbnailTask = urlSession?.dataTask(with: URL(string:url)!) data, res, err in

      if err != nil
      print("error from dataResponse:(err?.localizedDescription ?? "Response Error")")
      failure()
      return

      DispatchQueue.main.async

      if let imageData = data, let image = UIImage(data: imageData)
      success(image)
      URLCache.shared.removeAllCachedResponses()




      self.imageThumbnailTask?.resume()


      func imageThumbnailcall()
      self.indicaotrTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.HandleOverTime), userInfo: nil, repeats: false)

      self.imageCaller( url: self.isShowingThermal ? self.thermalUrl : self.visualUrl, success: (image) in

      self.indicaotrTimer?.invalidate()

      DispatchQueue.main.async
      self.imageLoaderIndicator.stopAnimating()
      self.backGroundImageView.image = image

      if self.isInVC
      self.imageThumbnailcall()

      )
      self.imageLoaderIndicator.stopAnimating()




      Worth mentioning that this line:



       let handler = AuthenticateHandler()
      self.urlSession = URLSession(configuration: URLSessionConfiguration.default, delegate: handler, delegateQueue: OperationQueue.main)


      for digest protocol










      share|improve this question
















      So i am doing a network calls to retrieve image and using that i am show a kind of a video.
      After a while i can see the memory lose and energy impact:
      enter image description here



      after a while my app crushed and i got :"Terminated due to memory issue error"



      Before that i got that error from the image caller method:"error from dataResponse:The operation couldn’t be completed. No space left on device"



      This are the two method i use:



      class InstallationViewController: BaseViewController {

      func imageCaller(url: String , success: @escaping (UIImage) -> Void, failure: @escaping () -> Void)
      let handler = AuthenticateHandler()
      self.urlSession = URLSession(configuration: URLSessionConfiguration.default, delegate: handler, delegateQueue: OperationQueue.main)

      self.imageThumbnailTask = urlSession?.dataTask(with: URL(string:url)!) data, res, err in

      if err != nil
      print("error from dataResponse:(err?.localizedDescription ?? "Response Error")")
      failure()
      return

      DispatchQueue.main.async

      if let imageData = data, let image = UIImage(data: imageData)
      success(image)
      URLCache.shared.removeAllCachedResponses()




      self.imageThumbnailTask?.resume()


      func imageThumbnailcall()
      self.indicaotrTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.HandleOverTime), userInfo: nil, repeats: false)

      self.imageCaller( url: self.isShowingThermal ? self.thermalUrl : self.visualUrl, success: (image) in

      self.indicaotrTimer?.invalidate()

      DispatchQueue.main.async
      self.imageLoaderIndicator.stopAnimating()
      self.backGroundImageView.image = image

      if self.isInVC
      self.imageThumbnailcall()

      )
      self.imageLoaderIndicator.stopAnimating()




      Worth mentioning that this line:



       let handler = AuthenticateHandler()
      self.urlSession = URLSession(configuration: URLSessionConfiguration.default, delegate: handler, delegateQueue: OperationQueue.main)


      for digest protocol







      ios swift caching nsurlsession digest






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 12:40







      ironRoei

















      asked Nov 14 '18 at 11:51









      ironRoeiironRoei

      366113




      366113






















          2 Answers
          2






          active

          oldest

          votes


















          1














          Looks like you have a retain cycle in your closure in the imageThumbnailcall function.
          The closure creates a strong reference to self, and since it's a recursive function you will run out of memory pretty quick.
          You need to capture self as [weak self] or [unowned self] in the closure.
          Example using [unowned self]:



          func imageThumbnailcall() 
          self.indicaotrTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.HandleOverTime), userInfo: nil, repeats: false)

          self.imageCaller( url: self.isShowingThermal ? self.thermalUrl : self.visualUrl, success: [unowned self] (image) in

          self.indicaotrTimer?.invalidate()

          DispatchQueue.main.async
          self.imageLoaderIndicator.stopAnimating()
          self.backGroundImageView.image = image

          if self.isInVC
          self.imageThumbnailcall()

          )
          self.imageLoaderIndicator.stopAnimating()




          If you want to learn more about






          share|improve this answer























          • I think i have tried it in the past , but i will make sure right now. the reference of self is regarding backGroundImageView?

            – ironRoei
            Nov 14 '18 at 14:39






          • 1





            So everything that refers to self in that closure will lead to a reference cycle. This is because self already has a strong reference to the closure (self.imageCaller), and when you use self in a closure without a capture list, the closure creates a strong reference back to self. And that creates a reference cycle.

            – bangerang
            Nov 14 '18 at 16:30












          • So you were right. It improves dramatically the memory usage. I have one problem: when i am doing weak self i need to modify all the self in the closer to "self?" then i need to modify self?.isInVC to (self?.isInVC)! thats crushing my app later. any idea?

            – ironRoei
            Nov 15 '18 at 11:20











          • and still i am getting "error from dataResponse:The operation couldn’t be completed. No space left on device" some times

            – ironRoei
            Nov 15 '18 at 11:38


















          0














          Looks like you're recursively calling imageThumbnailcall. If you don't end the recursion at some point, you could see exactly the symptoms that you are reporting.



           if self.isInVC 
          self.imageThumbnailcall()



          Are you making sure to set isInVC properly so you break out of the recursive loop?






          share|improve this answer























          • Yes, the whole point is to call it recursively to have a kind of video

            – ironRoei
            Nov 14 '18 at 14:18







          • 1





            k. Thought I'd ask. As long as you've got something that is setting isInVC false before you run out of memory and overflow. You might try using Instruments and watching your allocations to help debug.

            – Mark Thormann
            Nov 14 '18 at 14:22






          • 1





            Another related thought would be the call to isInVC. Doesn't look like that's on the main thread? If you're doing anything w/UI that might be a problem. You might try moving that to the main thread.

            – Mark Thormann
            Nov 14 '18 at 14:24











          • I do so...: DispatchQueue.main.async self.imageLoaderIndicator.stopAnimating() self.backGroundImageView.image = image

            – ironRoei
            Nov 14 '18 at 14:30











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299624%2fios-terminated-due-to-memory-issue-error%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Looks like you have a retain cycle in your closure in the imageThumbnailcall function.
          The closure creates a strong reference to self, and since it's a recursive function you will run out of memory pretty quick.
          You need to capture self as [weak self] or [unowned self] in the closure.
          Example using [unowned self]:



          func imageThumbnailcall() 
          self.indicaotrTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.HandleOverTime), userInfo: nil, repeats: false)

          self.imageCaller( url: self.isShowingThermal ? self.thermalUrl : self.visualUrl, success: [unowned self] (image) in

          self.indicaotrTimer?.invalidate()

          DispatchQueue.main.async
          self.imageLoaderIndicator.stopAnimating()
          self.backGroundImageView.image = image

          if self.isInVC
          self.imageThumbnailcall()

          )
          self.imageLoaderIndicator.stopAnimating()




          If you want to learn more about






          share|improve this answer























          • I think i have tried it in the past , but i will make sure right now. the reference of self is regarding backGroundImageView?

            – ironRoei
            Nov 14 '18 at 14:39






          • 1





            So everything that refers to self in that closure will lead to a reference cycle. This is because self already has a strong reference to the closure (self.imageCaller), and when you use self in a closure without a capture list, the closure creates a strong reference back to self. And that creates a reference cycle.

            – bangerang
            Nov 14 '18 at 16:30












          • So you were right. It improves dramatically the memory usage. I have one problem: when i am doing weak self i need to modify all the self in the closer to "self?" then i need to modify self?.isInVC to (self?.isInVC)! thats crushing my app later. any idea?

            – ironRoei
            Nov 15 '18 at 11:20











          • and still i am getting "error from dataResponse:The operation couldn’t be completed. No space left on device" some times

            – ironRoei
            Nov 15 '18 at 11:38















          1














          Looks like you have a retain cycle in your closure in the imageThumbnailcall function.
          The closure creates a strong reference to self, and since it's a recursive function you will run out of memory pretty quick.
          You need to capture self as [weak self] or [unowned self] in the closure.
          Example using [unowned self]:



          func imageThumbnailcall() 
          self.indicaotrTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.HandleOverTime), userInfo: nil, repeats: false)

          self.imageCaller( url: self.isShowingThermal ? self.thermalUrl : self.visualUrl, success: [unowned self] (image) in

          self.indicaotrTimer?.invalidate()

          DispatchQueue.main.async
          self.imageLoaderIndicator.stopAnimating()
          self.backGroundImageView.image = image

          if self.isInVC
          self.imageThumbnailcall()

          )
          self.imageLoaderIndicator.stopAnimating()




          If you want to learn more about






          share|improve this answer























          • I think i have tried it in the past , but i will make sure right now. the reference of self is regarding backGroundImageView?

            – ironRoei
            Nov 14 '18 at 14:39






          • 1





            So everything that refers to self in that closure will lead to a reference cycle. This is because self already has a strong reference to the closure (self.imageCaller), and when you use self in a closure without a capture list, the closure creates a strong reference back to self. And that creates a reference cycle.

            – bangerang
            Nov 14 '18 at 16:30












          • So you were right. It improves dramatically the memory usage. I have one problem: when i am doing weak self i need to modify all the self in the closer to "self?" then i need to modify self?.isInVC to (self?.isInVC)! thats crushing my app later. any idea?

            – ironRoei
            Nov 15 '18 at 11:20











          • and still i am getting "error from dataResponse:The operation couldn’t be completed. No space left on device" some times

            – ironRoei
            Nov 15 '18 at 11:38













          1












          1








          1







          Looks like you have a retain cycle in your closure in the imageThumbnailcall function.
          The closure creates a strong reference to self, and since it's a recursive function you will run out of memory pretty quick.
          You need to capture self as [weak self] or [unowned self] in the closure.
          Example using [unowned self]:



          func imageThumbnailcall() 
          self.indicaotrTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.HandleOverTime), userInfo: nil, repeats: false)

          self.imageCaller( url: self.isShowingThermal ? self.thermalUrl : self.visualUrl, success: [unowned self] (image) in

          self.indicaotrTimer?.invalidate()

          DispatchQueue.main.async
          self.imageLoaderIndicator.stopAnimating()
          self.backGroundImageView.image = image

          if self.isInVC
          self.imageThumbnailcall()

          )
          self.imageLoaderIndicator.stopAnimating()




          If you want to learn more about






          share|improve this answer













          Looks like you have a retain cycle in your closure in the imageThumbnailcall function.
          The closure creates a strong reference to self, and since it's a recursive function you will run out of memory pretty quick.
          You need to capture self as [weak self] or [unowned self] in the closure.
          Example using [unowned self]:



          func imageThumbnailcall() 
          self.indicaotrTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.HandleOverTime), userInfo: nil, repeats: false)

          self.imageCaller( url: self.isShowingThermal ? self.thermalUrl : self.visualUrl, success: [unowned self] (image) in

          self.indicaotrTimer?.invalidate()

          DispatchQueue.main.async
          self.imageLoaderIndicator.stopAnimating()
          self.backGroundImageView.image = image

          if self.isInVC
          self.imageThumbnailcall()

          )
          self.imageLoaderIndicator.stopAnimating()




          If you want to learn more about







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 14:37









          bangerangbangerang

          8113




          8113












          • I think i have tried it in the past , but i will make sure right now. the reference of self is regarding backGroundImageView?

            – ironRoei
            Nov 14 '18 at 14:39






          • 1





            So everything that refers to self in that closure will lead to a reference cycle. This is because self already has a strong reference to the closure (self.imageCaller), and when you use self in a closure without a capture list, the closure creates a strong reference back to self. And that creates a reference cycle.

            – bangerang
            Nov 14 '18 at 16:30












          • So you were right. It improves dramatically the memory usage. I have one problem: when i am doing weak self i need to modify all the self in the closer to "self?" then i need to modify self?.isInVC to (self?.isInVC)! thats crushing my app later. any idea?

            – ironRoei
            Nov 15 '18 at 11:20











          • and still i am getting "error from dataResponse:The operation couldn’t be completed. No space left on device" some times

            – ironRoei
            Nov 15 '18 at 11:38

















          • I think i have tried it in the past , but i will make sure right now. the reference of self is regarding backGroundImageView?

            – ironRoei
            Nov 14 '18 at 14:39






          • 1





            So everything that refers to self in that closure will lead to a reference cycle. This is because self already has a strong reference to the closure (self.imageCaller), and when you use self in a closure without a capture list, the closure creates a strong reference back to self. And that creates a reference cycle.

            – bangerang
            Nov 14 '18 at 16:30












          • So you were right. It improves dramatically the memory usage. I have one problem: when i am doing weak self i need to modify all the self in the closer to "self?" then i need to modify self?.isInVC to (self?.isInVC)! thats crushing my app later. any idea?

            – ironRoei
            Nov 15 '18 at 11:20











          • and still i am getting "error from dataResponse:The operation couldn’t be completed. No space left on device" some times

            – ironRoei
            Nov 15 '18 at 11:38
















          I think i have tried it in the past , but i will make sure right now. the reference of self is regarding backGroundImageView?

          – ironRoei
          Nov 14 '18 at 14:39





          I think i have tried it in the past , but i will make sure right now. the reference of self is regarding backGroundImageView?

          – ironRoei
          Nov 14 '18 at 14:39




          1




          1





          So everything that refers to self in that closure will lead to a reference cycle. This is because self already has a strong reference to the closure (self.imageCaller), and when you use self in a closure without a capture list, the closure creates a strong reference back to self. And that creates a reference cycle.

          – bangerang
          Nov 14 '18 at 16:30






          So everything that refers to self in that closure will lead to a reference cycle. This is because self already has a strong reference to the closure (self.imageCaller), and when you use self in a closure without a capture list, the closure creates a strong reference back to self. And that creates a reference cycle.

          – bangerang
          Nov 14 '18 at 16:30














          So you were right. It improves dramatically the memory usage. I have one problem: when i am doing weak self i need to modify all the self in the closer to "self?" then i need to modify self?.isInVC to (self?.isInVC)! thats crushing my app later. any idea?

          – ironRoei
          Nov 15 '18 at 11:20





          So you were right. It improves dramatically the memory usage. I have one problem: when i am doing weak self i need to modify all the self in the closer to "self?" then i need to modify self?.isInVC to (self?.isInVC)! thats crushing my app later. any idea?

          – ironRoei
          Nov 15 '18 at 11:20













          and still i am getting "error from dataResponse:The operation couldn’t be completed. No space left on device" some times

          – ironRoei
          Nov 15 '18 at 11:38





          and still i am getting "error from dataResponse:The operation couldn’t be completed. No space left on device" some times

          – ironRoei
          Nov 15 '18 at 11:38













          0














          Looks like you're recursively calling imageThumbnailcall. If you don't end the recursion at some point, you could see exactly the symptoms that you are reporting.



           if self.isInVC 
          self.imageThumbnailcall()



          Are you making sure to set isInVC properly so you break out of the recursive loop?






          share|improve this answer























          • Yes, the whole point is to call it recursively to have a kind of video

            – ironRoei
            Nov 14 '18 at 14:18







          • 1





            k. Thought I'd ask. As long as you've got something that is setting isInVC false before you run out of memory and overflow. You might try using Instruments and watching your allocations to help debug.

            – Mark Thormann
            Nov 14 '18 at 14:22






          • 1





            Another related thought would be the call to isInVC. Doesn't look like that's on the main thread? If you're doing anything w/UI that might be a problem. You might try moving that to the main thread.

            – Mark Thormann
            Nov 14 '18 at 14:24











          • I do so...: DispatchQueue.main.async self.imageLoaderIndicator.stopAnimating() self.backGroundImageView.image = image

            – ironRoei
            Nov 14 '18 at 14:30
















          0














          Looks like you're recursively calling imageThumbnailcall. If you don't end the recursion at some point, you could see exactly the symptoms that you are reporting.



           if self.isInVC 
          self.imageThumbnailcall()



          Are you making sure to set isInVC properly so you break out of the recursive loop?






          share|improve this answer























          • Yes, the whole point is to call it recursively to have a kind of video

            – ironRoei
            Nov 14 '18 at 14:18







          • 1





            k. Thought I'd ask. As long as you've got something that is setting isInVC false before you run out of memory and overflow. You might try using Instruments and watching your allocations to help debug.

            – Mark Thormann
            Nov 14 '18 at 14:22






          • 1





            Another related thought would be the call to isInVC. Doesn't look like that's on the main thread? If you're doing anything w/UI that might be a problem. You might try moving that to the main thread.

            – Mark Thormann
            Nov 14 '18 at 14:24











          • I do so...: DispatchQueue.main.async self.imageLoaderIndicator.stopAnimating() self.backGroundImageView.image = image

            – ironRoei
            Nov 14 '18 at 14:30














          0












          0








          0







          Looks like you're recursively calling imageThumbnailcall. If you don't end the recursion at some point, you could see exactly the symptoms that you are reporting.



           if self.isInVC 
          self.imageThumbnailcall()



          Are you making sure to set isInVC properly so you break out of the recursive loop?






          share|improve this answer













          Looks like you're recursively calling imageThumbnailcall. If you don't end the recursion at some point, you could see exactly the symptoms that you are reporting.



           if self.isInVC 
          self.imageThumbnailcall()



          Are you making sure to set isInVC properly so you break out of the recursive loop?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 14:16









          Mark ThormannMark Thormann

          1,251712




          1,251712












          • Yes, the whole point is to call it recursively to have a kind of video

            – ironRoei
            Nov 14 '18 at 14:18







          • 1





            k. Thought I'd ask. As long as you've got something that is setting isInVC false before you run out of memory and overflow. You might try using Instruments and watching your allocations to help debug.

            – Mark Thormann
            Nov 14 '18 at 14:22






          • 1





            Another related thought would be the call to isInVC. Doesn't look like that's on the main thread? If you're doing anything w/UI that might be a problem. You might try moving that to the main thread.

            – Mark Thormann
            Nov 14 '18 at 14:24











          • I do so...: DispatchQueue.main.async self.imageLoaderIndicator.stopAnimating() self.backGroundImageView.image = image

            – ironRoei
            Nov 14 '18 at 14:30


















          • Yes, the whole point is to call it recursively to have a kind of video

            – ironRoei
            Nov 14 '18 at 14:18







          • 1





            k. Thought I'd ask. As long as you've got something that is setting isInVC false before you run out of memory and overflow. You might try using Instruments and watching your allocations to help debug.

            – Mark Thormann
            Nov 14 '18 at 14:22






          • 1





            Another related thought would be the call to isInVC. Doesn't look like that's on the main thread? If you're doing anything w/UI that might be a problem. You might try moving that to the main thread.

            – Mark Thormann
            Nov 14 '18 at 14:24











          • I do so...: DispatchQueue.main.async self.imageLoaderIndicator.stopAnimating() self.backGroundImageView.image = image

            – ironRoei
            Nov 14 '18 at 14:30

















          Yes, the whole point is to call it recursively to have a kind of video

          – ironRoei
          Nov 14 '18 at 14:18






          Yes, the whole point is to call it recursively to have a kind of video

          – ironRoei
          Nov 14 '18 at 14:18





          1




          1





          k. Thought I'd ask. As long as you've got something that is setting isInVC false before you run out of memory and overflow. You might try using Instruments and watching your allocations to help debug.

          – Mark Thormann
          Nov 14 '18 at 14:22





          k. Thought I'd ask. As long as you've got something that is setting isInVC false before you run out of memory and overflow. You might try using Instruments and watching your allocations to help debug.

          – Mark Thormann
          Nov 14 '18 at 14:22




          1




          1





          Another related thought would be the call to isInVC. Doesn't look like that's on the main thread? If you're doing anything w/UI that might be a problem. You might try moving that to the main thread.

          – Mark Thormann
          Nov 14 '18 at 14:24





          Another related thought would be the call to isInVC. Doesn't look like that's on the main thread? If you're doing anything w/UI that might be a problem. You might try moving that to the main thread.

          – Mark Thormann
          Nov 14 '18 at 14:24













          I do so...: DispatchQueue.main.async self.imageLoaderIndicator.stopAnimating() self.backGroundImageView.image = image

          – ironRoei
          Nov 14 '18 at 14:30






          I do so...: DispatchQueue.main.async self.imageLoaderIndicator.stopAnimating() self.backGroundImageView.image = image

          – ironRoei
          Nov 14 '18 at 14:30


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299624%2fios-terminated-due-to-memory-issue-error%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Barbados

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3