Re: Memory Leak in Daemon
Re: Memory Leak in Daemon
- Subject: Re: Memory Leak in Daemon
- From: m <email@hidden>
- Date: Mon, 19 Jul 2004 14:07:14 -0700
On Jul 19, 2004, at 1:36 PM, Kodex wrote:
I have been putting the finishing touches on my daemon and have
noticed that i get a 1 MB memory leak each cycle through the loop that
is added onto private memory. I am not sure how to release my pool or
call dealloc in a deamon so i think that might be the cause. I have
provided a link to my source code as well
http://dragon-forged.com/memoryleak.txt just incase those arent the
issues. Thanks guys!
Try another NSAutoReleasePool in your while loop:
while(keepGoing)
{
NSAutoreleasePool* innerPool = [[NSAutoreleasePool alloc] init];
// do your interesting stuff here...
[innerPool release];
}
That way the pool (and thus your Cocoa objects) is released each time
through the loop instead of only when your daemon exits.
_murat
_______________________________________________
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.