Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A coding pattern that does not work under Garbage Collection




[...]

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >A coding pattern that does not work under Garbage Collection (From: Rick Hoge <email@hidden>)
 >Re: A coding pattern that does not work under Garbage Collection (From: Jim Correia <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.