[racket] disable garbage collection

From: Eduardo Bellani (ebellani at gmail.com)
Date: Thu Jun 2 13:01:14 EDT 2011

Cool, thanks, lots of info to chew on.

On 06/02/2011 01:24 PM, Neil Van Dyke wrote:
> My current interest is in satisfying a client's request (to analyze
> certain things with the GC disabled), but here's a few reasons I can
> imagine that people sometimes want to disable GC in languages in general
> (not specific to Racket):
> * Performance: you have a fairly short-lived performance-sensitive
> program, you don't want to pay the time cost of GC, and you have enough
> RAM.  In Racket, I haven't noticed GC being a problem.  (Before Java
> became popular, and when computers were a *lot* slower, it was common
> for people to be prejudiced against GC'd languages, and there were jokes
> about getting "collecting garbage..." messages at inopportune moments in
> life-critical real-time systems.  I don't see much of that sentiment
> anymore.)
> * Evaluation: related to performance, but another way to measure the
> cost of GC when tuning, with the intention of normally running with GC. 
> In Racket, there are other ways to measure GC cost, and this would be an
> additional way.
> * Debugging: if you're debugging when doing low-level programming or
> interfacing with less-trustworthy C code, disabling GC lets you
> eliminate GC as a possible cause of trouble.  Again, in Racket, this
> isn't a concern for most people, just like it's not a concern for most
> Java programmers.
> * Extremely Unusual Situations: if you're in the unusual situation of
> doing something normally considered inadvisable, like you're
> intentionally designing the SR-71 to leak fuel, maybe there's some
> bizarre rocket-scientist reason understood only by you that you have to
> turn off GC just to get your app to fly in one piece.  Almost no one
> will ever need this, and, in the case of Racket, they could always add
> it if they did.
> BTW, for the mechanism for disabling GC, I think I actually have a
> preference for having all the GC code in place as normal, so that the
> usual code paths are used, and simply having the (conceptual)
> do-we-want-to-do-a-gc-cycle-now function always return false.  I'd try
> to avoid running any blocks of code not already covered by users who are
> running GC.
> Eduardo Bellani wrote at 06/02/2011 10:01 AM:
>> Out of curiosity, why would you want to disable GC?
>> On 06/02/2011 10:30 AM, Matthew Flatt wrote:
>>> At Thu, 02 Jun 2011 00:25:04 -0400, Neil Van Dyke wrote:
>>>> When running Racket apps from the command line, is there a way to
>>>> disable garbage collection?
>>> There's currently no way to disable GC. I'll look into adding one.

Eduardo Bellani

omnia mutantur, nihil interit.

Posted on the users mailing list.