• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Leaks When Running MultiThreaded (Even w/ AutoRelease Pool)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Leaks When Running MultiThreaded (Even w/ AutoRelease Pool)
      • From: Charles Srstka <email@hidden>
References: 
 >Leaks When Running MultiThreaded (Even w/ AutoRelease Pool) (From: Philip Weaver <email@hidden>)

  • Prev by Date: Re: Accessing window in document applications
  • Next by Date: Cocoa --> GnuStep
  • Previous by thread: Re: Leaks When Running MultiThreaded (Even w/ AutoRelease Pool)
  • Next by thread: Re: Leaks When Running MultiThreaded (Even w/ AutoRelease Pool)
  • Index(es):
    • Date
    • Thread