discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GSAutoreleasedMemory


From: Richard Frith-Macdonald
Subject: Re: GSAutoreleasedMemory
Date: Thu, 30 Nov 2006 16:47:32 +0000


On 30 Nov 2006, at 16:27, Marc Brünink wrote:

Richard Frith-Macdonald wrote:

On 30 Nov 2006, at 15:21, Marc Brünink wrote:

Hi all,

thanks to NSDebug I found two small memory leaks. However there's another one:
I'm loosing 2 instances of GSAutoreleasedMemory every few runloops.

I do not understand /usr/src/core/base/Source/Additions/ GSObjCRuntime.m at the moment. So could anyone explain me the use of GSAutoreleasedMemory please?

GSAutoreleasedMemory is a private class whose instances are used to wrap an area of memory on the heap which is to be freed when the enclosing autorelease pool is deallocated. It should be impossible for this to be leaked unless you are running without an autorelease pool... in which case you should get lots of warning messages. Are you sure you are not misinterpreting things?
No. Of course I'm not sure :-)
However I'm also loosing an autoreleased local NSString. So I've a problem with AutorelasePools. However I do not get any "autorelease called without pool...." message. Perhaps I'm getting an exception in a background thread, which is not caught. In such a case the corresponding pool wouldn't be released. However the thread itself would exit. Could this cause the problem?

If it doesn't exit cleanly, yes. On clean exit (ie the method the thread was launched with returns normally) the thread's autorelease pool is deallocated and all memory should be cleaned up ... assuming no bugs. If the thread exits abnormally ... eg it crashes or calls exit() then autoreleased stuff won't get deallocated.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]