Re: AutoreleasePool mechanics
Re: AutoreleasePool mechanics
- Subject: Re: AutoreleasePool mechanics
- From: Ondra Cada <email@hidden>
- Date: Thu, 20 Dec 2001 17:06:45 +0100
mikevannorsdel,
>
>>>>> mikevannorsdel (m) wrote at Thu, 20 Dec 2001 07:25:57 -0700:
m> That's about what I figured. What I'm really curious about is the pool
m> provided by AppKit. Is this pool automatically replaced (cleaned)? If not,
m> it would seem an application can build a big pile of objects before
m> termination. The documentation says the AppKit automatically creates and
m> destroys pools. I wonder when and how often.
I am quite positive this is documented as well (though I don't just now
remember where exactly): for each event loop a new pool is created (and
destroyed when then even loop ends). Something like
while (evt=lowLevelServiceToGetTheNextEvent()) {
id pool=[[NSAutoreleasePool alloc] init];
[NSApp sendEvent:evt];
[pool relese];
}
though the actual implementation would be naturally more complicated.
So, unless you create a big pile of objects inside one event, there's no fear.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc