Re:Finding iOS Memory Leaks with Xcode's Instruments
by mikeash on Monday January 25, 2016 @10:50PM
(#10971724)
That makes no sense. Retain cycles are one potential cause of memory that is never freed, and the Leaks instrument picks them up fine.
Where it fails is when memory is not freed because it's still referenced somewhere from your live objects, but shouldn't be. For example, if you keep adding subviews to a view and don't use the old ones anymore, expecting them to be destroyed but forgetting to remove them from their superview first.
Basically, Leaks is a garbage collector minus the collector, and where it fails is exactly where garbage collectors can fail and still allow leaks. Like any sensible garbage collector, it can handle cycles just fine.
(I know you just quoted it, but I thought this was a good place to address this weird aspect of the article.)
Where it fails is when memory is not freed because it's still referenced somewhere from your live objects, but shouldn't be. For example, if you keep adding subviews to a view and don't use the old ones anymore, expecting them to be destroyed but forgetting to remove them from their superview first.
Basically, Leaks is a garbage collector minus the collector, and where it fails is exactly where garbage collectors can fail and still allow leaks. Like any sensible garbage collector, it can handle cycles just fine.
(I know you just quoted it, but I thought this was a good place to address this weird aspect of the article.)