Re: memory leak in readInBackgroundAndNotify
Re: memory leak in readInBackgroundAndNotify
- Subject: Re: memory leak in readInBackgroundAndNotify
- From: Ondra Cada <email@hidden>
- Date: Fri, 21 Apr 2006 16:23:42 +0200
Gurmit,
On Apr 21, 2006, at 1:03 PM, Gurmit Teotia wrote:
Thanks Greg & Ondra. I think I've to read more to clear my
understanding. But still this behaviour is confusing to me. For
time being I have use nested autorelease pool. Later on when I get
more familiar with it,
Actually, there is a simple yet quite satisfactory rule of thumb:
(a) if you are autoreleasing a comparatively small number of
comparatively small objects, leave it on the framework;
(b) whenever that what you autorelease is very big or there's a great
number of a-ed objects, use a nested pool.
There still are *some* exceptions (like that you have to use extra
pool always in +load or threads), but in a very vast majority of
cases those (a) and (b) above would work well.
I think I'll be able to understand where is the problem.
Well, very roughly: automatic pools are created/released on event
boundaries. Notifications are not events. Therefore, many
notifications may be served by one pool. OTOH, clicking is an event,
and therefore each click on a button is served by a separate pool.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden