views:

395

answers:

6

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.
+1  A: 

Sounds like a memory leak to me, you might want to check in that direction.

Razor
+1  A: 

Are you trying to load huge amount of data in a very short time? This is specially the case when trying to run an image view animation sequence. I got a crash when the memory was less than 20MB. After investigation I found that my image sequence contained very big images and the reason of crash was not total memory load. The reason was memory bandwidth.

taskinoor
"Memory bandwidth" does not cause a crash.
tc.
really? try to load 20MB of data from disk to RAM and from RAM to VRAM and see what happens.
taskinoor
At one time the most data i load may be tens of *.png . About hundreds KB.
ben
then this might not be ur problem. i got a crash on a 2g device while trying to load about 15 320 x 480 png images. but after preloading, the problem was resolved.
taskinoor
@taskinoor - What's causing the crash in your case is not memory bandwidth, but a spike in memory usage. If your application ever crosses the threshold for being killed (30 MB of total usage on earlier devices), it will be terminated.
Brad Larson
usually, memory warning also comes in when you run the other third party big memory resourced based app in the iOS 4.0.
Yoon Lee
+1  A: 

If you're on an older model like a 2g or 3g, 36 megs is probably more ram than you've got to play with. I usually start getting warnings around 25mb.

Dan Ray
+1  A: 

You get memory warnings when phone memory is low. "Level 1" memory warnings are pretty normal. If your app is crashing, then it's probably because you're not handling the memory warning properly rather than because you're using too much memory. There are two fixes:

  • Ignore the memory warning (don't super-call in didReceiveMemoryWarning)
  • Fix your code
tc.
+1  A: 

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.

kpower
+3  A: 

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.

Stephen Darlington
yeah,i test it with my ipad,i think the problem most likely that i use too much memory,i can run my app at the 36-40MB memory used for 20 min at least.i think it's regular
ben