Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
Hi all..

In my app, the applicationReceivedMemoryWarning is getting called??

how to trace out the origin / who is responsible to call, which line in code ???

Plzzzzzz help.....
 

SwampThingTom

macrumors member
Jul 12, 2008
37
0
Fairfax, VA
Hi all..

In my app, the applicationReceivedMemoryWarning is getting called??

how to trace out the origin / who is responsible to call, which line in code ???

Plzzzzzz help.....

The Instruments tool is a great way to track down memory leaks. The "Instruments User Guide" in the Dev Center describes how to use it. Very easy and *very* useful.

Tom
 

Enuratique

macrumors 6502
Apr 28, 2008
276
0
Hi all..

In my app, the applicationReceivedMemoryWarning is getting called??

how to trace out the origin / who is responsible to call, which line in code ???

Plzzzzzz help.....

It's called by the iPhone OS when it realizes it's about to run out of memory. There is no singular place to find out who's calling it. The intent of that method being called is to try and release any non-essential allocated memory to prevent a force-quit of your app. Chances are, however, you have a memory leak that needs plugging.
 

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
It's called by the iPhone OS when it realizes it's about to run out of memory. There is no singular place to find out who's calling it. The intent of that method being called is to try and release any non-essential allocated memory to prevent a force-quit of your app. Chances are, however, you have a memory leak that needs plugging.

But my app is taking a max of 2.75MB (highest peak shown in INSTRUMENTS)...
I read that around 24MB is available as heap space...

Is the above method(AppRecievedMemoryWarning) get called at those lines, where alloc /copy occurs??
 

Enuratique

macrumors 6502
Apr 28, 2008
276
0
But my app is taking a max of 2.75MB (highest peak shown in INSTRUMENTS)...
I read that around 24MB is available as heap space...

Is the above method(AppRecievedMemoryWarning) get called at those lines, where alloc /copy occurs??

How long is your app running before it gets the memory warning? Does Instruments say you still have leaks? Is Instruments collecting data throughout the life of the program (I had a weird case where Instruments would stop collecting data after my app's initialization phase). Could you possibly take a screenshot of Instruments when the memory warning happens?

Also, the "peak" memory may be a misleading thing to look at. Take for example Instruments running my app.

InstrumentsExplanation.png


Note how the peak is less than total memory consumed over the life of the application. It's possible you have a thread that Instruments isn't measuring so any leaks in that thread are going undetected and thus causing the low memory warning. If that overall bytes column is continuously growing (even after initialization has completed) and you're not doing anything in the application - then I think that's a telltale sign you have a leak somewhere. I'd be curious to know what the overall bytes value is when you receive the low memory warning.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.