views:

569

answers:

5

Hey there,

so heres the story, Apple recently rejected my app, saying it crashed on their phones, (iPhone 3G and ipod touch 2g), and send me two crash logs. NEITHER of which I can make sense out of.

Here they are.

 Incident Identifier: BA4382DD-DA6A-47F7-800D-43AD30919064
 CrashReporter Key:   53e41ca2a52f91affddc86f49ce9c4be851fcfd6
 OS Version:          iPhone OS 3.1.2 (7D11)
 Date:                2010-01-14 15:59:57 -0800

Free pages:        317
Wired pages:       11274
Purgeable pages:   0
Largest process:   iConicCars

Processes
         Name                 UUID                    Count resident pages
       amfid <b4f3e5a61456edf85b6ada59064ec311>      93
  iConicCars <851d264eb074e465891dcd67b67a8e79>    5928 (jettisoned) (active)
  MobileMail <0798395dde43ca46317db6e674dfbbfd>     503 (jettisoned)
 MobilePhone <82c9bd8583f4b09706a16b08e641a4b9>     464 (jettisoned)
     notifyd <d6b12a4e424e10e5ce91efd8d39f22af>      77
    BTServer <c940c4c7252113a7303cc1f7d1429c17>     253
  CommCenter <b1d6c4fe3ce2bc0374471196ab15b8d4>     313
 SpringBoard <c5c29b56a2bb445fc73203e03f67fa78>    1954 (active)
  accessoryd <32ceed5c3c32625ac23cd870f61364af>     107
     configd <aae411e8289912124271f109ceee8f85>     290
   fairplayd <cdce5393153c3d69d23c05de1d492bd4>     156
   mDNSResponder <db98efaea94329959789f73a16f9f46e>     123
mediaserverd <612fbbfa0546609cf6c6b13ae6f333cf>     767 (jettisoned)
   lockdownd <171865bfe3725c3d5047df8c00ed5d77>     294
     syslogd <1cb3e9f2375fad9e345bd16655be4a50>      66 (jettisoned)
     launchd <c5bc115d47313218505394f96770782a>      76

**End**

Incident Identifier: 8E52889B-0260-4AAD-A39C-FC170FB637D4
CrashReporter Key:   45d118e8a4be9b3163eab905af870f05dfddb12d
OS Version:          iPhone OS 3.1.2 (7D11)
Date:                2010-01-14 13:41:31 -0800

Free pages:        309
Wired pages:       12550
Purgeable pages:   0
Largest process:   iConicCars

Processes
         Name                 UUID                    Count resident pages
      iConicCars <851d264eb074e465891dcd67b67a8e79>    5641 (jettisoned) (active)
       SCHelper <b87bd080a670f9512426e8721dc1f03c>     103
            misd <a41e5d5f4b8922ab272c55df84aec4fd>     140
    installd <620ede129454bcd824f0b6cec13b15d3>     212
 SpringBoard <c5c29b56a2bb445fc73203e03f67fa78>    1545 (jettisoned) (active)
        iapd <fea164e93479b90e1dd39a293dd3865c>     251 (jettisoned)
     syslogd <1cb3e9f2375fad9e345bd16655be4a50>      83 (jettisoned)
mediaserverd <612fbbfa0546609cf6c6b13ae6f333cf>     302 (jettisoned)
    BTServer <c940c4c7252113a7303cc1f7d1429c17>     345
   lockdownd <171865bfe3725c3d5047df8c00ed5d77>     279
     notifyd <d6b12a4e424e10e5ce91efd8d39f22af>     104
  CommCenter <b1d6c4fe3ce2bc0374471196ab15b8d4>     151
     configd <aae411e8289912124271f109ceee8f85>     264
   fairplayd <cdce5393153c3d69d23c05de1d492bd4>     517
   mDNSResponder <db98efaea94329959789f73a16f9f46e>     100
     launchd <c5bc115d47313218505394f96770782a>      67

**End**

they said even after a reboot, there is no difference. Heres the kicker, it works perfectly on my iPhone 3GS, and in the simulator with NO memory leaks.

So, what on earth do i do?

UPDATE:

Log for in the simulator [Session started at 2010-01-16 20:01:44 +1300.] GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all Attaching to process 1152. dyld: could not load inserted library: /usr/lib/libgmalloc.dylib

Data Formatters temporarily unavailable, will re-try after a 'continue'. (Cannot call into the loader at present, it is locked.) warning: Couldn't find minimal symbol for "_sigtramp" - backtraces may be unreliable Cannot access memory at address 0x0 Cannot access memory at address 0x0 (gdb)

+3  A: 

Your app used too much memory. Check your app with Instruments (Object Allocations or Leaks) and see if you can reduce memory allocation.

KennyTM
what are good ways to reduce memory allocations? and is it best to let the system manage it (NSString *string = @"hello";) or do it yourself like (NSString *string = [[NSString alloc] init];)
Sam Jarman
For strings, `NSString* const string = @"hello";` if possible. If you do it yourself remember to `-release` it.
KennyTM
+2  A: 

You app is using way, way too much memory. It'll never run on older devices with 128 MB of RAM.

Darren
can you just specify that you need a newer device to run it? they are only going to get faster and faster.
Sam Jarman
Do you really want to drop 10-20 million people out of the running to buy your application when you could just spend some time optimizing and make it work for everyone? For a game I could MAYBE see this argument if you were wanting to use only the latest OpenGL features.
Kendall Helmstetter Gelner
nah.. i'll try optimizing it.
Sam Jarman
To put it in perspective: with Safari, Mail, and iPod running in the background, a typical app can start triggering low-memory conditions at 1800 pages (in my experience). Your app is using almost 6000 pages before it's even off the ground. There's aren't minor leaks we're talking about; your app is doing something seriously wrong. The good news is that such egregious memory usage should be very easy to fix, once you figure out what the problem is.
Darren
@Darren. you think with something this wrong, there would some warnings or errors or something like that..
Sam Jarman
There are, the app is given a didReceiveMemoryWarning notification when memory is getting really tight. Your app should react to that and try and free up memory wherever it can. But if you use up memory fast enough, the app may not even get that and just be shut down.
Kendall Helmstetter Gelner
+4  A: 

See "free pages: 309"? not good, means you are using a bunch of memory then when it is all used it crashes. And the purgeable pages = 0 is memory that can't be reclaimed so it's a memory issue.

Do a "Build and Analyze" and run "Leaks" to find memory leaks and places you can run more efficiently.

ACBurk
I have no leaks though. ALl memory seems to be /accounted/ for.
Sam Jarman
+3  A: 

Your iPhone 3GS and the Simulator have far more memory than the other iPhone OS devices. To work on all devices, you should use no more than 20 MB of memory.

CajunLuke
how do you tell if how much its using now?
Sam Jarman
Have you tried running your apps in Instruments (Run -> Run with Performance tools...)
KennyTM
yes i have. and thinks look ok to me. (although, that is not saying much whatsoever)
Sam Jarman
+3  A: 

As others have said, you are using too much memory.

If you are using multiple pages of view controllers, try this simple test - run your app with the ObjectAlloc Instrument. Click on something to bring up a subview, you should see your memory increase - now dismiss that view and go back to the main one, the memory should go down. If it does not, that is your problem (or one of them anyway, but that is a likley starting point).

To try and track this down, place breakpoints in dealloc for each of your view controllers and see what actually gets called. For view controllers that are not released like you expect, in ObjectAlloc you can see where each retain against an object was issued, and decide what retained the object when it should not have done so.

In general the ObjectAlloc flow should look like a graph that goes up and down all the time, not constantly rising.

Also if you are using a lot of images consider re-sizing them to the exact size you need instead of starting with a much larger size and scaling. Using that much memory must be due to using images and not releasing them. Leaks will not report anything if you still have references to memory you are retaining.

Also, buy an older Touch for testing.

Kendall Helmstetter Gelner
"Also if you are using a lot of images consider re-sizing them to the exact size you need instead of starting with a much larger size and scaling."i think that could be the problem.. read the comment on the question i just wrote.
Sam Jarman
I commented on that. There's really no reason you should have to have them all loaded though, you really should change it to load only images as you need them, and get rid on ones you are not using.
Kendall Helmstetter Gelner
OK. I JUST RAN THEM ALL THROUGH PHOTOSHOP, AND BROUGHT THE ALLOCATION TOTAL BACK DOWN TO AN ACCEPTABLE LEVEL. THANKS KENDALL.
Sam Jarman
I'd still recommend getting a Touch to try it out on... though I'll bet that helped a lot. I'm glad that seemed to be the main problem.
Kendall Helmstetter Gelner