Re: releasing NSArrays, NSDictionaries, etc ??
Re: releasing NSArrays, NSDictionaries, etc ??
- Subject: Re: releasing NSArrays, NSDictionaries, etc ??
- From: Ondra Cada <email@hidden>
- Date: Tue, 25 Sep 2001 16:51:18 +0200
Robert,
>
>>>>> Robert Miller (RM) wrote at Tue, 25 Sep 2001 10:09:51 -0400:
RM> Here's a very basic question, I think. It states in the Cocoa
RM> documentation that when an NS 'Mutable' array or dictionary is released,
RM> all of the objects it (they) contain are sent release messages as well.
RM> Does the same hold true for non-mutable forms of NSArray ,
RM> NSDictionary,etc.?
Yep.
RM> It mentions that a retain message is sent when added
RM> but, does not actually state that a release message is sent when object
RM> itself (the NSArray or NSDictionary) is released
deallocated, rather.
Otherwise, quite right: whenever an object is added to (any) container, it
is retained. Whenever it is removed from the container, it is released. If a
container is deallocated, first all objects it contains are removed (the
actual implementation might differ, but this is how it works).
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc