Re: Debugging strange memory ( ? ) problem
Re: Debugging strange memory ( ? ) problem
- Subject: Re: Debugging strange memory ( ? ) problem
- From: Ken Thomases <email@hidden>
- Date: Sun, 30 Apr 2017 17:38:10 -0500
On Apr 30, 2017, at 4:02 PM, Peter Hudson <email@hidden> wrote:
>
> Thanks Ken.
>
> I'll give zombies a go.
> What's baffling is that the pointer has remained the same - in terms of address - but the type of underlying object appears to be different.
> Not sure how that could happen.
There's a memory management bug somewhere. The object has been under-retained or over-released. As a result, it has been deallocated. Any pointer to it is now a "dangling" pointer. The pointer variable still contains the same address, but that address is no longer valid. Later, some other object may be allocated and given the address of the old object. The dangling pointers now, by coincidence, point to this new object. Disaster ensues.
This is exactly the scenario that the Zombies instrument detects. The original object is never actually deallocated. It's just transformed into a landmine that deliberately blows up your program when it's accessed. Since it was never deallocated, no other object can be allocated in its place. The fact that the zombie object is a landmine may sound bad, but it's actually much better then the semi-random things that can happen otherwise. Finding problems early and definitively is good. Finally, Instruments is able to give you the information necessary to figure out how the object was under-retained or over-released.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden