This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: guile/guile-core/libguile init.c


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]