Re: A coding pattern that does not work under Garbage Collection
Re: A coding pattern that does not work under Garbage Collection
- Subject: Re: A coding pattern that does not work under Garbage Collection
- From: Rick Hoge <email@hidden>
- Date: Fri, 9 Nov 2007 11:47:31 -0500
[...]
You kept a (default, no strong or weak modifier) pointer to data
inside the object, but no one kept a pointer to the object, so it
was collected.
So if I had added the __strong modifier to the pointer assignment, the
collector would know not that the memory was still in use?
As there are probably better ways of approaching this kind of
situation, I'd be interested in any suggestions or comments. The
way I was doing it before was probably just bad...
You can allocate GC'd memory with NSAllocateCollectable.
Thanks - this is very helpful. I am trying to find code examples but
the usage is fairly clear. Playing with this in Instruments it looks
like it does what it's supposed to.
Rick
_______________________________________________
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