i use instruments to track my app's usage of memory,in memory monitor,i find that real memory is below 36MB ,and most time it just 32MB,but i still get warnings low memory in organizer and crashed.
Incident Identifier: CFEF044E-E839-4DB7-9ED6-E22CD92B9171
CrashReporter Key: 80954447762f1882da7df309d5493cf8647f4c8b
OS Version: iPhone OS 3.2 (7B367)
Date: 2010-08-10 15:21:25 +0800
Free pages: 593
Wired pages: 18705
Purgeable pages: 1664
Largest process: iPad4HB
Processes
Name UUID Count resident pages
iPad4HB <51ec4f748adb8d99e4456ba49644e516> 27182 (jettisoned) (active)
debugserver <6f10136b8d55ad8cbd29c09a402b1f94> 149
syslog_relay <4ceaed776d2df957fa130712f4ef21d0> 70
notification_pro <4c9a7ee0a5bbe160465991228f2d2f2e> 71
lsd <a4d852c1c8da2b3d231bdc90887b52ba> 143
apsd <f655e615956fa9881fd423d762791e7d> 197
notifyd <5e9d5bee7c3eae1c8b494c79eb11406e> 62
BTServer <64e4a6ea6b1240db2331e05a29caa862> 132
CommCenter <97bf297944ac4bde19bcee96dd23bd5f> 191
SpringBoard <c7a5904c12db7b14334a4edaa4cabaa9> 4844 (active)
accessoryd <b4e1403f53e4c7b53b0ec833007f6589> 122
configd <aca9fa3380322669164fd6b1a3864300> 374
fairplayd.K48 <2d997ffca1a568f9c5400ac32d8f0782> 86
locationd <dd1ea88105c62173908ce767db5c4d37> 654
mDNSResponder <820560222d47a1f2a0dce98a7f8a9721> 112
mediaserverd <ea8bac28b06fe3980fdd44b5caceb563> 5931
lockdownd <497fd54c79a680bf29f5d9320f514613> 579
MobileStorageMou <c277b79c2157c4dc5cfc5c3ca35bd5f2> 76
syslogd <66247e305d5c0bf6f1ce1cc950653263> 80
ptpd <83de0f774bd6553d513ae9e19b0f9b56> 233
launchd <66972eee4d865c4383b33d985d22994b> 72
**End**
Tue Aug 10 15:12:05 hokudaiaoniaowangruande-iPad SpringBoard[26] <Warning>: Received memory warning. Level=1
Tue Aug 10 15:12:05 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: Received memory warning. Level=1
Tue Aug 10 15:12:20 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:12:32 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:12:32 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:12:37 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:13:28 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:13:28 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:13:44 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:14:11 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:14:11 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:14:20 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:14:50 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:14:50 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:14:56 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:15:02 hokudaiaoniaowangruande-iPad mDNSResponder[19] <Error>: ERROR: mDNSPlatformReadTCP - recv: 60 (Operation timed out)
Tue Aug 10 15:16:11 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:16:11 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:17:33 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:17:44 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:17:44 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:18:01 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:18:07 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:18:07 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:18:07 hokudaiaoniaowangruande-iPad configd[24] <Notice>: jetsam: kernel memory event (90), free: 695, active: 1734, inactive: 985, purgeable: 3456, wired: 18656
Tue Aug 10 15:18:07 hokudaiaoniaowangruande-iPad SpringBoard[26] <Warning>: Received memory warning. Level=2
Tue Aug 10 15:18:07 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: Received memory warning. Level=2
Tue Aug 10 15:18:07 hokudaiaoniaowangruande-iPad SpringBoard[26] <Warning>: Memory level is urgent (10%) and there are no background apps to ask to exit.
Tue Aug 10 15:19:07 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:19:15 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:19:15 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:20:02 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:20:06 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:20:06 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:21:01 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:21:06 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playable
Tue Aug 10 15:21:06 hokudaiaoniaowangruande-iPad iPad4HB[107] <Warning>: playing
Tue Aug 10 15:21:24 hokudaiaoniaowangruande-iPad configd[24] <Notice>: jetsam: kernel termination snapshot being created
Tue Aug 10 15:21:24 hokudaiaoniaowangruande-iPad com.apple.launchd[1] (UIKitApplication:com.yourcompany.iPad4HB[0x4df4][107]) <Notice>: (UIKitApplication:com.yourcompany.iPad4HB[0x4df4]) Bug: launchd_core_logic.c:3232 (24063):0
Tue Aug 10 15:21:24 hokudaiaoniaowangruande-iPad com.apple.launchd[1] (UIKitApplication:com.yourcompany.iPad4HB[0x4df4][107]) <Notice>: (UIKitApplication:com.yourcompany.iPad4HB[0x4df4]) Bug: launchd_core_logic.c:3309 (24063):0
Tue Aug 10 15:21:24 hokudaiaoniaowangruande-iPad com.apple.debugserver-44[106] <Warning>: 1 [006a/1703]: error: ::read ( 6, 0x2809f4, 1024 ) => -1 err = Bad file descriptor (0x00000009)
Tue Aug 10 15:21:24 hokudaiaoniaowangruande-iPad com.apple.launchd[1] (UIKitApplication:com.yourcompany.iPad4HB[0x4df4][107]) <Notice>: (UIKitApplication:com.yourcompany.iPad4HB[0x4df4]) Bug: launchd_core_logic.c:2650 (24063):10
Tue Aug 10 15:21:24 hokudaiaoniaowangruande-iPad com.apple.launchd[1] (UIKitApplication:com.yourcompany.iPad4HB[0x4df4][107]) <Notice>: (UIKitApplication:com.yourcompany.iPad4HB[0x4df4]) Working around 5020256. Assuming the job crashed.
I think it's telling you exactly what the problem is: you're using too much memory. If the OS tells you this and you do nothing about it then it may (indeed, does) eject your program from memory.
You don't post any code so it's not clear whether you have a memory leak or are just using too much memory. Try using the static analyser (in the build menu of Xcode) and the Leaks part of Instruments to check for leaks. If it doesn't find any then you may just have to optimise your app to use less memory.
I'm not sure where you found that 36Mb is okay. On first gen devices you'll get kicked out of memory much above 20Mb. I don't think there's any absolute number documented, so you need to do two things: test on real devices and release as much memory as possible when it tells you that you're using too much.
Seems to be a memory leak. To find it, use not only "Leaks" Instrument. "Allocations" also can help you. Use it actively, mark heaps, compare memory usage and examine "still alive" objects (especially objects of your own classes).
Sometimes memory leaks can't be automatically detected (with "Leaks" Instrument). For example, imagine that you have some UIImageView. This image view should be created, when user touches "Create" button, and destroyed, when he touches "Destroy" button. You can implement this behavior like in code below:
- (IBAction)bCreateTouchUpInside:(id)sender {
ivSomeImageView = [[UIImageView alloc] initWithImage:iSomeImage];
[self.view addSubview:ivSomeImageView];
bCreate.enabled = NO; bDestroy.enabled = YES;
}
- (IBAction)bDestroyTouchUpInside:(id)sender {
[ivSomeImageView release];
bCreate.enabled = YES; bDestroy.enabled = NO;
}
And there will be a memory leak: two-times retained (creation + addSubview), one-time released (release). To solve the problem, you should add [ivSomeImageView removeFromSuperview];
before direct release message. But this leak won't be detected by "Leaks" Instrument, cause there is a correct pointer to your image view (parent view stores pointers to it's subviews). And the only chance to detect this leak for you is to press "Create" for numerous times and to see that memory usage increases each time.
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