Is it possible to debug "Termination due to a memory error"?

At a specific (sequential) point, when my application is running, I receive an xcode error message in sequence

Completed due to a memory error.

I cannot find the code causing the error, but I can tell which code is close to the error (using breakpoints).

The error is caused immediately after the return of a certain cell in my execution

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

UITableViewDataSource delegate method. I can confirm that it returns a valid UITableViewCell , but I think explaining and posting all of this method would be a waste of time. However, I suspect this could be caused by a fast, massive memory allocation.

He definitely says Terminated due to memory error , not memory pressure.

I would like to know what a message means. Also, is there a way to debug this message? Failure report is not generated.

I am using ARC and iOS 7.

+68
memory-management ios objective-c automatic-ref-counting
Oct 05 '13 at 23:29
source share
6 answers

I was getting this error and could not understand what was wrong.

After some searching, I found out that I forgot to disable the zombies.

To disable, follow these steps:

Select edit scheme

Deselect "Enable Zombie Objects

+49
May 19 '14 at 14:55
source share

I ran into the same problem . ("Termination due to a memory error") I tried all of the above answers, but nothing works for me. Then I debug my code and find that the for loop runs indefinitely with allocating memory to an array with a zero value each time. It uses 300 + MB, so it gives this error

Thank.

+8
Apr 14 '16 at 7:09
source share

I had exactly the same problem. I thought this caused my program to leak memory or use too much memory. I use tools and use a distribution profile, and the program works fine. In addition, I ran the device program long enough, and it also works great.

I also use the 3rd generation iPad for debugging, this may be due to this slow device or error, it looks like it's just Xcode and works from the Xcode problem. Not a memory leak or allocation problem.

If you make sure that the tools and application on the device itself are working

+4
Nov 11 '13 at 7:28
source share

I used Tesseract for OCR, and when my target text received a scan, the GIF was supposed to play. When GIF began to play, there was a burst of memory from 70-80MB to 450MB. The problem was that the GIF took up too much memory, the application would crash, and Xcode would show this message. Therefore, I removed the corresponding imageView from the ViewController supervisor.

 imageView.removeFromSuperview 

After that, the application will continue to grow to 450 MB, and then immediately free and go down to 40 MB

+4
Jan 11 '17 at 12:05
source share

Change the scheme, in the "Diagnostics" section you will find several options for protecting distributions. See the documentation for more details .

Question: does it really say “terminated due to a memory error” rather than “pressure”? Check the tools if your application is running low in memory, if your application seems to be running low, and then what you should focus on no matter what the exact message is.

+2
06 Oct '13 at 0:34
source share

Restarting the device worked for me. The message “Interrupted due to a memory error” has stopped appearing.

0
Jun 20 '19 at 12:28
source share



All Articles