• 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: deallocation of related objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: deallocation of related objects


  • Subject: Re: deallocation of related objects
  • From: publiclook <email@hidden>
  • Date: Tue, 11 Mar 2003 22:03:09 -0500

You can create a subclass of NSObject and then have your subclass pose as
NSObject. In this way you can override -dealloc to remove your custom
meta-data. See various discussions of the +poseAsClass method. All
subclasses of NSObject will then call your -dealloc which can (should) call NSObject's -dealloc.


On Tuesday, March 11, 2003, at 08:31 PM, Daryn wrote:

I have an interesting problem for which I'd like implementation suggestions. In the general sense, I need to be able to be able to invisibly attach metadata to any existing objc object. When the object is destroyed, then the metadata needs to be freed.

My current/flawed implementation involves using a NSMap table to associate the non-retained object with a pointer to its extra data. However, I cannot find a suitable way to know when the object has been destroyed so that I may remove the entry in the map table and free the metadata.

The key to the problem is that I can't subclass the objc objects. The attachment needs to be transparent. I'd feel really dirty if I had to twiddle __CFOASafe and use __OARecordAllocationEvent to watch for __kCFReleaseEvent...

Daryn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: deallocation of related objects
      • From: Philip Mötteli <email@hidden>
References: 
 >deallocation of related objects (From: Daryn <email@hidden>)

  • Prev by Date: Re: deallocation of related objects
  • Next by Date: Resizing window to fit drawer
  • Previous by thread: Re: deallocation of related objects
  • Next by thread: Re: deallocation of related objects
  • Index(es):
    • Date
    • Thread