views:

346

answers:

3

Hello,

I have developed one 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%) and there are no background apps to ask to exit.

Please help me.

Regards, Pratik

A: 

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.

Mavrik
Mavrik, I am already doing Build and Analyze to check memory leaks where I don't get any error / warning, which means I am doing memory checking. What else memory check should I do? Please let me know
pratik
I'm not talking only about memory leaks. Maybe you really don't have a memory leak, but you load a huge image for example and iPhone runs out of memory. That wouldn't be a memory leak (you still keep a track of memory containing the image) but your application would still get killed because iPhone ran out of memory.That's what I meant by check memory: use a profiler or check code to see if you're loading/generating anything that would use alot of memory.Without actual code I can't give you a better advice.
Mavrik
A: 

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.

Jasarien
+1  A: 

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.

zupamario