Subject: Re: Destructors
From: Erik Naggum <erik@naggum.net>
Date: Sat, 29 Jun 2002 05:05:48 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3234315948769890@naggum.net>

* Kaz Kylheku
| You may run out of descriptors if you generate too many open file descriptors
| before the next garbage collection happens (GC probably won't be triggered on
| the condition of running out of descriptors!)

  This is actually an important point.  I had an application once that I tuned
  down to cons very little memory, but which opened and closed a lot of
  streams.  In Allegro CL at the time, streams allocated buffers from a pool of
  memory that was not garbage collected the same way other Lisp memory was
  (called the C heap -- I think the reason was that the buffers should stay put
  and not move around with their stop-and-copy garbage collector).  This memory
  could also not be released the same way a huge Lisp heap could be released
  once it had all turned into garbage.  My application had been running for
  about three months when I noticed that it had consumed lots of swap space.
  It had showed no signs of slowing down, either, bu the dataset was now some
  280M of C heap and 120M or so with Lisp heap.  By decreasing the garbage
  collection frequency, I had accidentally let the C heap grow *huge* before
  the Lisp heap triggered a garbage collection and almost all of it was freed.
  The Lisp heap was fairly stable -- most of the objects created during a day's
  run would remain in memory until the midnight cleanup -- so I had effectively
  turned off garbage collection during the day.  Tuning the garbage collection
  so it happened about every half hour during the working hours led to a 16M C
  heap and 70M Lisp heap -- because the objects were now in old space instead
  of the duplicated new space.  It was an important lesson in the mechanics of
  garbage collection, which turned out to be useful when I decided to live the
  same place for more than two years -- annual copying garbage collection had
  worked just fine during my university years.
-- 
  Guide to non-spammers: If you want to send me a business proposal, please be
  specific and do not put "business proposal" in the Subject header.  If it is
  urgent, do not use the word "urgent".  If you need an immediate answer, give
  me a reason, do not shout "for your immediate attention".  Thank you.