views:

108

answers:

1

I have a quite a big iPad app and when I run the app in xcode debug mode, it shows about 50 MB in the Activity Monitor and memory grows slowly. (About 0.1 MB per 30 seconds approximately.) But when I run the app directly from the simulator(which is already installed in the simulator) , it shows about 10 MB in the activity monitor and memory is not growing.(its constant). I have checked the performance though the instruments and no leaks showing there.

Does anyone know for reason to showing different memory details for above 2 scenarios and which one is correct?

Also is there a way to programatically print the consumed memory by the app in the console?

+1  A: 

Activity Monitor is a generally useless way to track memory growth. There are about a zillion different contributors to RPRVT, some of which are entirely non-intuitive. Activity Monitor can certainly be used to figure out "uh, oh, it is growing", but not much beyond that.

Use Instruments to track memory growth.

When you say "run in Debug mode", do you have anything configured like zombie tracking or allocation information tracking? That'll contribute to memory growth.

Beyond that, the Allocation Instrument will generally show you what is contributing to growth.

Also is there a way to programatically print the consumed memory by the app in the console?

An absolute number like this isn't very useful. That an app is growing is bad, but a raw number won't tell you why any more usefully than Activity Monitor.

Use Instruments. :)

bbum
Hi bbum, Thanks for your reply.yes. I have NSZombieEnabled in my app. I have used instruments. In Leaks it doesn't show anything leaks. In Allocations there are quite a large no of allocations and its difficult to identify what contributed to growth at once. Is there a way to clear all the memory snapshot and recapture from the beginning? Then it might be easier to identify the newly allocated objects instead of all the objects allocated from the beginning of the app?
charith
NSZombieEnabled will cause objects to never be deallocated (unless you set NSDeallocateZombies=NO). It presumably doesn't show up as a leak because it's intentional.
tc.
hi bbum and tc,I have disabled the NSZombieEnabled. Now it works perfectly. Thank you very much for tip. I didnt know about it. Thanks again
charith
Excellent to read. Glad it worked.
bbum