• 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: Obj-C server and signal handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obj-C server and signal handling


  • Subject: Re: Obj-C server and signal handling
  • From: Dave Camp <email@hidden>
  • Date: Thu, 14 Feb 2008 11:32:53 -0800

On Feb 14, 2008, at 10:48 AM, Matt Mashyna wrote:

	NSRunLoop *loopy = [NSRunLoop currentRunLoop];
	while (keepRunning && [loopy runMode:NSDefaultRunLoopMode
		beforeDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]);



Creating an NSDate in that tight loop will leak memory on each iteration.

I've done something like this in the past (perhaps there is a better way):

while (running && !gSigTerm)
{
NSAutoreleasePool *innerPool = [[NSAutoreleasePool alloc] init];
running = [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
[innerPool release];
}


Dave
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Obj-C server and signal handling
      • From: Dave Camp <email@hidden>
References: 
 >Obj-C server and signal handling (From: Matt Mashyna <email@hidden>)

  • Prev by Date: Re: Changing app menu title programmatically
  • Next by Date: Re: Obj-C server and signal handling
  • Previous by thread: Obj-C server and signal handling
  • Next by thread: Re: Obj-C server and signal handling
  • Index(es):
    • Date
    • Thread