Re: NSTextView & Leaking Memory
Re: NSTextView & Leaking Memory
- Subject: Re: NSTextView & Leaking Memory
- From: Chris Ross <email@hidden>
- Date: Sat, 2 Aug 2003 19:41:12 +0100
I do this in my application.
Each loop is invoked using a menu item and therefore the release pool
is run.
I know this because I have other objects that release themselves.
I cant help but feel that when I appendAttributedString: the string I
append
is retain'ed but never released. Even if all the way up the tree of
objects is
on auto release. It's doing my nut in =/
Chris
On Saturday, August 2, 2003, at 07:39 pm, publiclook wrote:
In Appkit applications, the default autorelease pool is only
deallocated once per event cycle. If you are doing a lot of work
inside a loop and never letting events be processed, the default pool
is never dealocated and therefore does not release the objects it
contains.
The solution is simple and well documented by Apple and others
including this list:
Inside a loop:
{
// Create your own local pool
localPool = [[NSAutoreleasePool alloc] init];
// do something that autoreleases objects
// Cause local pool to be deallocated and it will release all
contained objects
[localPool release];
}
_______________________________________________
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.