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 GC behaviour


Ivan Karski <karski@nym.alias.net> writes:

 > -----BEGIN PGP SIGNED MESSAGE-----
 > 
 > Christian Lynbech <chl@tbit.dk> writes
 > 
 >    However, the allocation of new heap segments is kind of orthogonal to
 >    the gc process itself. The process goes something like this: when gc
 >    is finished it estimates the fraction of the heap cleared up. If this
 >    is too small, a new heap segment is allocated. 
 > 
 > Of what size?
 > 
 > In libguile/gc.c comments we read
 > 
 >  * SCM_INIT_HEAP_SIZE is the initial size of heap.  If this much heap is
 >  * allocated initially the heap will grow by half its current size
 >  * each subsequent time more heap is needed.
 > 
 > but the code is
 > 
 > #define SCM_EXPHEAP(scm_heap_size) (scm_heap_size*2)
 > 
 > So is it half or twice?

Not either, from what I recall of looking at the code yesterday.
SCM_EXPHEAP is the size of the new heap segment.  So presumably heaps
are of size X = SCM_INIT_HEAP_SIZE, 2*X, 2*2*X, ...  So, the heap
space with N segments = X*(1+2+...+ 2^(N-1)) ~= X*2^N.  Adding a new
segment adds X*2^N elements, so the heap size doubles, or it grows by
100%.

-- 
Harvey Stein
Bloomberg LP
hjstein@bfr.co.il

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