tags:

views:

149

answers:

2
+2  A: 

Bear in mind that the reason you see a 'leak' might be objects allocated to an AutoRelease pool. Libraries such as Three20 are particularly fond of this for image caching. If that is the case, the memory in question won't be released until there is a direct need for it (i.e. autorelease drain).

If you keep using your app, do you see a steady memory use climb, until a crash? Or do you see it like a sawtooth - i.e. going up, then suddenly down, then back up again?

Chaos
Well thats what my concern is, I am looking at the climb and not the sawtooth. A climb without any memory leaks being reflected. But memory keeep going up.
A: 

This looks like a case of an autorelease pool expanding and never draining. Hard to recommend anything without knowing about the particulars of your app (does it use multiple screens and tables or is it a single pane utility or game, etc.)

What you may consider doing is at logical points in your app -- for example when performing a single task -- create a new autorelease pool and use it only for the duration of that task, then release the pool. This will help keep your total memory down and give you better control over resources.

Also, if the app uses multiple view controllers, for example if you're bringing up a modal view or cascading treeviews, you can create the controller for the new view but then set a delegate on the viewcontroller that gets notified when the work is done so you can dispose of the whole controller and view instead of keeping it around.

Finally, if dealing with a lot of images you may want to create a sort of file-system-based caching mechanism with a fixed number of in-memory slots so you only keep data in memory that you absolutely need.

Ramin