• 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: Of input loops and games
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Of input loops and games


  • Subject: Re: Of input loops and games
  • From: Hari Seldon <email@hidden>
  • Date: Wed, 21 Sep 2005 21:13:00 -0500

Jack, could I form a bronzed statue of you and worship it day and
night? Thanks to you, my new threads and autorelease pools are working
like a charm, and my nightmarish memory leaks are but a vague memory.
Thanks again!

On 9/21/05, Jack Nutting <email@hidden> wrote:
>  Instead, you could use a static pointer in one of your recurring functions,
> perhaps modifying get_key_from_user() like this:
>
>  int get_key_from_user()
> {
>      static NSAutoreleasePool *pool = nil;
>
>      // first time through, this just sends release to nil, which is OK
>      [pool release];
>      pool = [[NSAutoreleasePool alloc] init];
>
>     // this blocks the thread until the main thread unlocks it
>     [[c_controller keyLock] lock];
>     return [c_controller getCurrentKeyAndClear];
>  }
>
>  The very first time get_key_from_user() is called, this will create a pool,
> and each subsequent time it will release the old pool and create a new one.
> This approach will end up doing a pool cleanup for each keypress, which is
> probably a pretty good granularity.
>
>  --
>
> // jack
> // http://www.nuthole.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Of input loops and games (From: Hari Seldon <email@hidden>)
 >Re: Of input loops and games (From: Jack Nutting <email@hidden>)
 >Re: Of input loops and games (From: Hari Seldon <email@hidden>)
 >Re: Of input loops and games (From: Sherm Pendley <email@hidden>)
 >Re: Of input loops and games (From: Hari Seldon <email@hidden>)
 >Re: Of input loops and games (From: Jack Nutting <email@hidden>)

  • Prev by Date: Re: obj-c: how do i call an instance method in my super's super?
  • Next by Date: Re: obj-c: how do i call an instance method in my super's super?
  • Previous by thread: Re: Of input loops and games
  • Next by thread: Need to Change the Ruler Units
  • Index(es):
    • Date
    • Thread