views:

140

answers:

1

Hi guys,

I am profiling my iPhone application with the 'Activity Monitor' Instrument. When I use UITableViews and scroll through them, I see the memory usage of my application go up all the time while I scroll. When I return to the previous view and the UITableViewController gets deallocated, the memory usage goes down a bit, but not to where it was previously. But the 'Leaks' instrument does not find any memory leaks, and neither does the static analyzer find some. I also ensured that there are never more than 12 UITableViewCells allocated at any time, so those are re-used properly (the Cells are also created with an appropriate autorelease so they will be de-allocated when unused). I'm also pretty sure that I don't have any memory leaks built into the code of the corresponding UITableViewController.

Is this normal behavior, e.g. will the application release the memory it has claimed at a later time, maybe when it is needed somewhere else?

Cheers and thanks in advance

MrMage

+2  A: 

Do you have NSZombieEnabled? I've seen this cause "incorrect" results in Instruments memory profiling since those instances will hang around.

nall
Thank you very much! Removing NSZombieEnabled did the trick. Another question: When I have NSZombieEnabled set and start my app directly, e.g. not from XCode, will NSZombieEnabled still be active? I hope not so, because I have sent my app to Apple while NSZombieEnabled was set...
MrMage
To the best of my knowledge zombies will still be enabled. NSZombieEnabled is an environment variable checked by the runtime, it's not an XCode thing.
nall
I just checked myself: it won't be active. I added the following code: TTAlert([[[NSProcessInfo processInfo] environment] objectForKey:@"NSZombieEnabled"]);And it would show 'YES' when run from XCode, but '' when run from Springboard directly.
MrMage
Oh, obviously. XCode sets the variable before running the executable where the phone won't. Must remember not to comment before coffee.
nall