• 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: NSMutableDictionary not sending release message to contained objects at dealloc time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableDictionary not sending release message to contained objects at dealloc time


  • Subject: Re: NSMutableDictionary not sending release message to contained objects at dealloc time
  • From: Greg Hurrell <email@hidden>
  • Date: Sun, 13 Apr 2003 07:48:33 +0930

El Saturday, 12 Apr, 2003, a las 21:56 Australia/Adelaide, publiclook escribis:

Are you deliberately being dense ?

No. Are you deliberately being as abrasive as possible?

NSMutableArray and NDMutableDictionary behave exactly the same with regard to retaining and releasing their contents.

This is what I expected, and I was surprised when I saw a discrepancy in the behaviour of my own code.

RTFM for gods sake.

I have been RTFM, and funnily enough, searching the archives too. In fact, I have even quoted "TFM" at more than one point in this thread, so it should be evident to you that I have been reading it. Are YOU deliberately being dense, troll etc?

You have gone around and around on this subject and you either refuse to read what people write or you are a troll. This is SIMPLE.

It seems you refuse to read what I write. In response to my original question I have received a couple of helpful responses, about four or five unwanted and unnecessary lectures on the behaviour of autorelease (which has no bearing whatsoever on my original question about release messages being sent on removal from collection classes), and a few abusive and unfair rants like yours.

Add an object to a collection an the object is retained by the collection.
Remove an object from a collection and the object is released by the collection.
When a collection is deallocated, it releases all objects it contains.

- Allocate collection object A. Its retain count is 1
- Add collection object A to collection B. A's retain count is 2 regardless of B's retain count.
- Add any number of objects to A.
- Remove A from B. A's retain count is 1.
- None of the objects previously added to A are released because they have not been removed from A and A has not been deallocated.

This is all correct, and it is exactly as I would expect. I, however, posted a code snippet where I was seeing the opposite. ie. an object being removed from a collection class and NOT receiving a release message at the time of removal. In other words, this line here:

- Remove A from B. A's retain count is 1.

In my code... the retain count was still 2, hence my original message. I just posted a hypothetical snippet that showed enough context to demonstrate where the problem was occurring.

Just for the record, I've said all I care to say on this one. This thread should have ended with Phill's code.

Greg
_______________________________________________
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.

References: 
 >Re: NSMutableDictionary not sending release message to contained objects at dealloc time (From: publiclook <email@hidden>)

  • Prev by Date: Re: NSMutableDictionary not sending release message to contained objects at dealloc time
  • Next by Date: Re: NSMutableDictionary not sending release message to contained objects at dealloc time
  • Previous by thread: Re: NSMutableDictionary not sending release message to contained objects at dealloc time
  • Next by thread: Re: NSMutableDictionary not sending release message to contained objects at dealloc time
  • Index(es):
    • Date
    • Thread