Reputation: 453
Please help me understand how can i use this statics shown in image.
How can i use heapshot effectively to detect memory leaks?
I have added image of Instrument using leaks.but i am unable to find exact location of memory leak.
Please guide me for this.
Upvotes: 0
Views: 573
Reputation: 45598
Basically a heapshot in this screenshot will display any objects that were created after the previous snapshot and that are still 'live' (have a retain count > 0).
The typical usage would be to hit "Mark Heap", then navigate into a view controller, tap a few buttons, perform a few actions, and then hit the 'back' button. Take another snapshot and examine the list of objects. You should make sure that there aren't any objects hanging around that should have been cleaned up. This may be things like the view controller itself, model objects, etc.
If you want to detect real leaks (unreferenced objects) use the Leaks tool. If you want to find other types of unbounded memory growth, i.e. objects that are still referenced and alive which shouldn't be, examine heapshots using the allocations tool like in this screenshot.
EDIT:
You added a Leaks screenshot to your original post. To see the stacktrace for where this object was allocated, click this button:
This should show you where the object was created. Then you need to figure out where the appropriate release call needs to go.
Upvotes: 2