Stephen Johnson
Stephen Johnson

Reputation: 5121

What can cause "Message from debugger: Terminated due to memory issue"

My app is sometimes crashing and the console says

Message from debugger: Terminated due to memory issue

Has anyone else experienced this and know some of what can cause this? Here is what I have tried so far.

  1. I have enabled Zombie Objects and it does not find anything.
  2. This only happens on my iPhone and so I can't run the other Memory Management tools that only run on the simulator (ie Guard Malloc).
  3. This only happens after a low memory warning. It doesn't happen after every memory warning, just after some memory warnings. When my app receives a memory warning, it clears out a number of caches and so my guess is that it is related to this.
  4. In the simulator I simulated memory warnings and this never happened.
  5. I thought that it might be related to a weak object so I added a symbolic break point on objc_weak_error. I did get the debugger to stop one this break point once and I fixed the weak error, but it did not fix the "Terminated due to memory issue".
  6. I though that maybe I wasn't freeing up enough memory, so I watched the total memory used by my app in Xcode and it never went over 50% of available memory.
  7. My app is a mixture of Objective-C and Swift code. It appears that this is coming from areas of my app that are written in Objective-C, but I am not 100% sure.

I would love to know if anyone else has experienced this issue and if so what you did to fix it. I have looked at the other Stack Overlow issues on this and so far none of them have given me any extra insight to this problem.

Upvotes: 1

Views: 1553

Answers (1)

Stephen Johnson
Stephen Johnson

Reputation: 5121

So one of my initial observations was wrong. I thought that my app never went above 50% of available memory (point 6 above). I was wrong. It did use up more memory and this error is coming because I did not release enough memory during the memory warning.

Upvotes: 1

Related Questions