Subject: Re: inhibiting GC
From: Erik Naggum <erik@naggum.no>
Date: 1999/06/02
Newsgroups: comp.lang.lisp
Message-ID: <3137280845702221@naggum.no>

* David Bakhash <cadet@bu.edu>
| I'm interested to know if there are ways to inhibit the GC from taking
| over.  Suppose you have a fn that you don't want to be interrupted by the
| GC.

  ("taking over"?  is that differing from "being performed"?)

  there are two basic ways to avoid GC in a particular function: (1) don't
  cons, and (2) GC before calling it.  it is not particularly hard to avoid
  consing, but it takes a special concern when writing the code, and you
  will realize that it involves doing your own local memory management,
  which basically means you either use all pre-allocated structures or you
  have to reimplement the functions that do the allocation.  a non-consing
  CONS could re-use cons cells off of a pre-allocated list, but you would
  have to free them when you are done with them.

  the problem is basically this: when GC occurs because you're out of free
  memory, what would you rather do?  fail, somehow?  that would easily cost
  more than a GC would, especially if your worry is real-time response.

  if you are only looking to avoid global gc's, that's controllable.  see
  the writeup in doc/cl/gc.htm in your Allegro CL installation directory.
  if you are looking for ways to minimize the cost of a scavenge in ACL,
  you can pretty much control that with the size of the newspace and the
  size of the oldspace allocation size.  if you don't ask for global gc
  when oldspace is full (the default, by the way), you don't do a global gc
  automatically (see *GLOBAL-GC-BEHAVIOR* and *TENURED-BYTES-LIMIT*), you
  can do global gc when you feel like it.  if your system is idle for long
  periods of time, you can make global GC happen in the idle time if that
  is more convenient.

  in general, you have pretty good control over the garbage collection, but
  I highly recommend reading the manual.  this is generally tricky stuff.

#:Erik
-- 
@1999-07-22T00:37:33Z -- pi billion seconds since the turn of the century