• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: A coding pattern that does not work under Garbage Collection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: A coding pattern that does not work under Garbage Collection
      • From: Jim Correia <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>)

  • Prev by Date: Re: How to talk with a kernel extension?
  • Next by Date: Re: Notification when switching Spaces?
  • Previous by thread: Re: A coding pattern that does not work under Garbage Collection
  • Next by thread: Re: A coding pattern that does not work under Garbage Collection
  • Index(es):
    • Date
    • Thread