This has been annoying me for a long time. My app runs taking up about 2.74MB of memory. That's fine. But then when it creates a UIWebView it goes up to around 5.87MB and proceeds to crash. Those are the values given under Live Bytes in Instruments while running on my 1st gen iPad.
There is no crash log that I can find. The following is from the console:
MyApp[1205] <Warning>: Received memory warning. Level=1 MyApp[1205] <Warning>: applicationDidReceiveMemoryWarning SpringBoard[30] <Warning>: Received memory warning. Level=1 MobileMail[1199] <Warning>: Received memory warning. Level=1 configd[26] <Notice>: jetsam: kernel memory event (95), free: 428, active: 1853, inactive: 1011, purgeable: 338, wired: 15122 configd[26] <Notice>: jetsam: kernel termination snapshot being created com.apple.launchd[1] <Notice>: (UIKitApplication:com.apple.mobilemail[0x8966]) Exited: Killed: 9 com.apple.launchd[1] <Notice>: (UIKitApplication:com.MyApp.MyApp[0xdd4f]) Exited: Killed: 9 SpringBoard[30] <Warning>: Application 'Mail' exited abnormally with signal 9: Killed: 9 kernel[0] <Debug>: launchd[1207] Builtin profile: MobileMail (sandbox) SpringBoard[30] <Warning>: Application 'MyApp' exited abnormally with signal 9: Killed: 9 configd[26] <Debug>: CaptiveNetworkSupport:UIAllowedNotifyCallback:70 uiallowed: false ReportCrash[1206] <Error>: libMobileGestalt loadBasebandMobileEquipmentInfo: CommCenter error: 1:45 ReportCrash[1206] <Error>: libMobileGestalt copyInternationalMobileEquipmentIdentity: Could not get mobile equipment info dictionary ReportCrash[1206] <Error>: Saved crashreport to /Library/Logs/CrashReporter/LowMemory-2011-05-12-160645.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0
I have removed all calls to imageNamed, changed autoreleased stuff to alloc/release. But I cannot work out why this is happening and it's driving me insane.
Thanks for any help!
When didReceiveMemoryWarning is called, it means your app is using too much memory (compare with memory of device), and you should release any additional memory used by your view controller to reduce the memory of your app. If the memory app gets over the memory of device, iOS will kill your app immediately.
Check how much storage you're using, delete unused apps, or temporarily remove apps taking up lots of space. Bouts of crashes could be due to insufficient storage space. If this is your issue, learn how to save storage on your iPad to prevent this from happening again. Install any available iPadOS updates.
The jetsam event report records how much memory each process used before jettisoning an app. The virtual memory system allocates and manages memory in chunks, called memory pages, and the report lists the memory use as the number of memory pages used.
I have two things to add that may help:
As mentioned in this answer use the following code
-(void) report_memory { struct task_basic_info info; mach_msg_type_number_t size = sizeof(info); kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size); if( kerr == KERN_SUCCESS ) { NSLog(@"Memory in use (in bytes): %u", info.resident_size); } else { NSLog(@"Error with task_info(): %s", mach_error_string(kerr)); } }
to see the amount of memory the operating system has assigned your app. That is more accurate number on the memory you app is using. (You will need to #import "mach/mach.h")
cheers!
You are almost certainly using a lot more memory than you think.
It's not obvious what you have to do to see what your app is really using, but once you do it a couple times, you'll remember.
Then you will see your Dirty memory (currently 20.34MB in my screenshot).
This should give you a much better picture of why your app is getting quit. You probably hav some large leaking happening.
good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With