This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: guile/guile-core/libguile init.c
- To: Greg Harvey <Greg dot Harvey at thezone dot net>
- Subject: Re: guile/guile-core/libguile init.c
- From: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>
- Date: 16 Mar 2000 00:24:46 +0100
- Cc: Jim Blandy <jimb at red-bean dot com>, guile at sourceware dot cygnus dot com
- Cc: djurfeldt at nada dot kth dot se
- References: <20000314151212.6846.qmail@sourceware.cygnus.com> <m3ln3l9u4r.fsf@savonarola.red-bean.com> <m366ung7b4.fsf@behemoth.dethfart.org>
Greg Harvey <Greg.Harvey@thezone.net> writes:
> Jim Blandy <jimb@red-bean.com> writes:
>
> > In his thesis, Ben Zorn recommends that one should not GC when the
> > freelist is exhausted. If you do this, then programs whose data size
> > is close to the current heap size will GC very frequently, because the
> > freelists will always be short. And since these GC's will reclaim
> > very little storage, the time they take is pretty much wasted.
> >
> > He suggests that the program should instead expand the heap whenever
> > the freelist is exhausted, and GC after every N allocations, where N
> > is a parameter. This way, the heap size naturally adjusts to match
> > the program's data size, and the GC frequency is more controlled.
> >
>
> If this were the case (for the first bit), guile would allocate a new
> segment (IIRC the threshold that used to be in before the change was
> 1/4 heap size, which is probably too small (scwm seems to like 1/2
> better), but offsets the fact that guile allocates way too much memory
> for consecutive segments); removing that and replacing it with some
> fixed number of cells and heap allocation when the freelist is
> exhausted, with everything else remaining the same, just causes more
> collections; once the heap starts filling up, this means scanning an
> awful lot just to potentially reclaim N objects (unless lots of stuff
> dies, but then both will still get back the same amount). You'd get
> better benefit from allowing the user to specify what portion of the
> current heap size should be available after a collection, allocating
> when it becomes overful.
This is how the new GC scheme works like. I took the Ben Zorn idea to
allocated heap when freelist is empty and GC after N cells (the GC
trigger) but added that GC won't happen if there happens to be yet
another N cells on the freelist. This way the Zorn N gets transformed
into a "minimum yield": If GC gives less than N heap is grown.
To solve the problem that Guile allocates too much heap I modified it
to always make the total heap size grow with a factor of 1.5.