While programming for iOS memory management is a most important task. If you dont handle memory properly it will kill your app.
Most of the iOS developers know about memory leaks, but only a very few know about abandoned memory. Lets have a discussion about what memory leak and abandoned memory is. And we will also look at how to find the abandoned memory in our application.
Memory leak
Memory leak is a part of memory which is left alone and no longer has any reference to it. A part of memory which is not linked by any pointer.
Abandoned memory
Abandoned memory is a part of memory which is not used by the application but has a valid reference to it. A valid pointer to that memory will be there but the memory itself wont be used anymore.
The abandoned memory can be tracked down by using Allocation instrumentation tool.
Select Product -> Profile
Choose allocations tool
Repetitively perform an action in your app that starts and finishes in the same state.
After each iteration of the repeated action, click the Mark Heap button to take a snapshot of the heap.
Analyze objects captured by the heap snapshot to locate abandoned memory.
No comments:
Post a Comment