• 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: correctly Controlling Garbage Collection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: correctly Controlling Garbage Collection


  • Subject: Re: correctly Controlling Garbage Collection
  • From: Rob Keniger <email@hidden>
  • Date: Sun, 18 Oct 2009 11:48:19 +1000

On 16/10/2009, at 4:17 PM, WareTo Development wrote:

> Looking at this problem, we could perform better memory management, so deep garbage collection does not happen that often. This reduces the problem, but can never eliminate it, since sooner or later the garbage clean operation must be done.
>
> So we thought the best thing would be to force a garbage collection operation at a time of our choosing.  Normally, this occurs at Mouse up, after the user has finished his drawing. A split second of garbage collection then would be barely noticeable by the user.


What happens if you explicitly disable Garbage Collection when the user starts drawing and enable it when the user finishes?

Something like:

- (void)mouseDown:(NSEvent*)event
{
	[[NSGarbageCollector defaultCollector] disable];
	//other mouse down stuff
}

- (void)mouseUp:(NSEvent*)event
{
	[[NSGarbageCollector defaultCollector] enable];
	[[NSGarbageCollector defaultCollector] collectExhaustively];
	//other mouse up stuff
}

That way the collector should never fire while the user is drawing.

--
Rob Keniger



_______________________________________________

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: correctly Controlling Garbage Collection
      • From: Quincey Morris <email@hidden>
References: 
 >correctly Controlling Garbage Collection (From: WareTo Development <email@hidden>)

  • Prev by Date: Re: GC and atomic getters/setters
  • Next by Date: Re: Programming Style: Method Definition with or without a semicolon.
  • Previous by thread: correctly Controlling Garbage Collection
  • Next by thread: Re: correctly Controlling Garbage Collection
  • Index(es):
    • Date
    • Thread