I have developed an iPhone application with Snow Leopard (10.6.2) and Xcode (3.2.1). As many of us know that in this new version of Xcode we get facility of Build and Analyze (to check memory leaks and other issues). When I build and analyze my application, it gives me no error / no warnings.
My application runs fine on simulator also.
Now, I try to test the application on iPhone device (device configuration: iPhone 2G and iPhone OS 3.0) with 8GB memory.
The problem is that application starts well on iPhone device but after some time, it crashes.
When I see the console from Window->Organizer->Console. I see following error:
Tue Dec 22 17:17:39 unknown SpringBoard[27] : Memory level is urgent (8%开发者_StackOverflow社区) and there are no background apps to ask to exit.
The analyzer will only detect the most obvious memory issues. You should give your app a quick run through instruments leak checking.
Go to Run -> Run with performance tool -> Leaks
Instruments will start up and it will appear very confusing if you did not use it before. It is best to consult the Instruments documentation at this point for further clarification of whats going on.
I will be shure there are plenty of leaks in your App and with Instruments you can find and debug even the hardest memory issues.
Obviously the device runs out of memory and your application is killed. Which means that your application probably uses too much memory. Which explains why the app runs fine on simulator on a desktop system with at least 10x as much RAM.
You're probably ignoring the low memory messages from OS as well. You'll need to check memory usage of your application.
The analyzer shouldn't be trusted 100%. It can throw false positives and in some cases not pick up on ever single error the code. It's great help, but by no means a "one stop shop for bug fixes".
Also, while the analyzer may show that you have no leaks, you may just not be releasing memory at all? As CharlieP said, we can't help you without any code.
It could be possible that you have circular retain cycles that prevent you from ever fully releasing objects.. And of course this is just one of many many possibilities. We need to see code.
精彩评论