Re: Leaks When Running MultiThreaded (Even w/ AutoRelease Pool)
Re: Leaks When Running MultiThreaded (Even w/ AutoRelease Pool)
- Subject: Re: Leaks When Running MultiThreaded (Even w/ AutoRelease Pool)
- From: Rich Long <email@hidden>
- Date: Sat, 4 May 2002 08:18:54 -0400
At 8:35 PM -0500 5/3/02, Philip Weaver wrote:
My application behaves *leak-free* when run single-threaded. I've
verified this using OmniObjectMeter. But, when I integrate threading
into this exact same code, all sorts of objects do not get released.
And I am creating an AutoreleasePool for the worker thread and am
even releasing it at the end of the worker thread.
Do you have any pointers for other causes of memory leaks when threading?
[...]
Hi Phil-
I came across one leak when developing a threaded app. I had a worker
thread that put up a progress dialog, and it consistently leaked an
object on thread termination.
To isolate the problem, I created a test project that loads and
immediately releases a panel from a nib in either the main context or
from a thread. When loaded from the thread (an autorelease pool is in
place), it exhibited the leak:
NSAutoreleaseNoPool(): Object 0x1f0a60 of class NSCalibratedRGBColor
autoreleased with no pool in place - just leaking
Oddly, if I loaded (and released) the panel from the main context
FIRST, subsequent thread loads caused no errors.
As a fix, I added an initialize class method to my window controller
class, and it simply loads and releases the panel. Subsequent calls
to load the panel, whether from a thread or not, now work fine.
Rich
_______________________________________________
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.