I am working on an iOS application that will create many small objects and floats, and try to understand how many of them consume memory.
When I run the "Allocations" tool, it says that I have about 2 MB of "live bytes" and this figure remains approximately constant when I move through the application (spikes up to 3 MB or so when the application is busy, but then drops up to 2 MB).
But when I run the Activity Monitoring tool, my Real Memory application is 25 MB after the launch is complete and grows quickly when painting happens inside my CALayer. In less than a minute, it exceeds 100 MB.
Why does "Live Bytes" show 2MB, but "Real Memory" shows 100MB?
My CALayer draws many paths, it binds the processor 100% in a few seconds to finish one drawing operation, and loads all these points from the NSData object into CGPoint values, and then undo them again (NSData object is a compressed version of the selected points, saving the delta from one point to another, so I store it in RAM, but not save the actual CGPoints).
It also caches the drawing result in UIImage, and they are stored in a first-in-first-out array, which does not grow to more than 500 KB.
ios memory-leaks objective-c instruments
Abhi Beckert Jan 09 '12 at 20:48 2012-01-09 20:48
source share