Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The New iPad: Low Memory Warnings Not Appearing?

Tags:

I have been developing an application for iPad that is very graphically intensive. I have been able to squeeze quite a bit of performance out already on the iPad 2, but the @2x graphics for the new iPad are packing quite the punch in the memory department. Using the Activity Monitor in Instruments I am able to see the size of my application mushrooming into the 300MB-400MB range but I do not receive any low memory notifications. I am using a UINavigationController to manage my views, so getting down into the stack has a cumulative effect on memory that ends in its eventual termination. I do not experience this problem on the iPad 2, where I receive low memory notifications as expected. My app has been coded to clean up as much as possible and performs very well on that device.

I have read a number of similar questions asked:

IOS app killed for Low Memory but no Memory Warning received
iPhone app uses 150 MB memory and still no low memory warning!

None of the suggestions seem to help.

I have inserted code to force a low-memory notification to be sent:

[[UIApplication sharedApplication] _performMemoryWarning];

This does cause the inactive views to unload as expected and returns memory consumption to normal. This uses a private API and is hack, so for practical reasons is not a solution. How do I get my device to properly respond to low memory conditions and let my app know that it needs to clean up??

like image 939
Wayne Hartman Avatar asked Mar 17 '12 21:03

Wayne Hartman


People also ask

Why am I not getting notifications on my iPad?

Go to Settings > Notifications, select the app, and make sure that Notifications are turned on. If you have notifications turned on for an app but you're not receiving alerts, you might have Banners turned off. Go to Settings > Notifications, turn on Show as Banners and choose a type of banner that you want to see.

Why does my iPad say not enough memory?

When the iPhone storage is full, iOS shows an alert saying “Not enough storage.” This is not exactly an error per se, rather it is a clear indication that the cluttered storage needs to be cleared by removing the redundant files.

How do I enable push notifications on my iPad?

Turn off or on: Tap Settings > Notifications, select an app, and toggle Allow Notifications off or on. Choose an alert style: For active notifications, select Lock Screen, Notification Center, or Banners.


1 Answers

I contacted the Apple Support to solve my memory problem and asked about the low-memory warnings on iPad 3:

-Because memory warnings are delivered on the main thread, your app will not receive memory warnings if it's blocking the main thread.

-Even if your app is not blocking the main thread, it is possible for memory usage to grow quickly enough that memory warnings are not delivered before your app is killed to free memory.

-Memory warnings trigger when the kernel transitions between various levels of memory pressure. Because of this, it is common for an app to receive a memory warning and then be killed quite some time later when memory is exhausted. The initial memory warning freed enough memory to keep the app alive, but not enough for the kernel to transition to a lower level of memory pressure.

Because of all this, memory warning should be treated as a useful data on the state of the hardware and a good guide on how much memory your app should use on a given device, but should not be relied on as a tool to prevent your app from being killed.

Maybe this helps...

like image 109
robbash Avatar answered Oct 12 '22 12:10

robbash