Re: [[object autorelease] release]
Re: [[object autorelease] release]
- Subject: Re: [[object autorelease] release]
- From: Markus Hitter <email@hidden>
- Date: Tue, 2 Oct 2001 17:42:09 +0200
Am Dienstag, 2. Oktober 2001 um 16:05 schrieb Ondra Cada:
(i) it does not "crash when you release an autorelease[d] object".
friendly, as you are, you contradict yourself a few lines later ...
(*) it might even not crash at all, or crash later.
... which is the same or even worse from the programmers perspective.
[o autorelease]; // the address of o, say, 0x123456, is placed to pool
[o release]; // the object at the address 0x123456 is freed
...anything... // another, quite randomly selected object, say,
X, might be
created at address 0x123456
[pool release]; // the object at address 0x123456 is released;
This is the exact description of the feature I'm missing: the
object is released/freed twice. Thank you. If an object is
released, it is to be made sure, not to have it still in any
autorelease pool.
Given this additional feature, you could avoid all hassles with
nested autorelease pools. They would be just obsolete.
The downside is probably, there is no way to remove a single
given object efficiently from an autorelease pool. At least not
as efficiently as when it is released by the pool's mechanism.
I can't say anything sure about that last topic, so I'd still
consider it as a valuable enhancement to Cocoa's Foundation.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/