[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] GC and heap growth percentage question

From: Peter Bex
Subject: Re: [Chicken-hackers] GC and heap growth percentage question
Date: Sat, 23 Jun 2012 23:48:38 +0200
User-agent: Mutt/

On Sat, Jun 23, 2012 at 11:03:43PM +0200, Felix wrote:
> C_heap_growth gives the percentage (relative to the old size) to what
> the heap should grow in case of a dynamic heap resize.

It can't grow any more than that during any given GC cycle, unless I'm

C_rereclaim2() is always called with percentage(heap_size, C_heap_growth) as
its first argument.  This means the "size" argument is 2*heap_size
Later, new_heapspace is allocated at this size and new_tospace_limit is
set to new_tospace_start+size.  In really_remark() the size is calculated
and if new_tospace_top exceeds new_tospace_limit it gives the familiar
"out of memory - heap full while resizing" error.

IIUC, this means that whenever more stuff is allocated between two GCs
(old heap + stack?) than twice the heap, it will fail.  I'm not sure yet
how this situation would happen, but there are a lot of places which hold
values that are remarked, so I can imagine there could be situations
where these taken together are more than twice the current heap.

> Using a higher value will grow the heap at a faster rate. This is just
> one more factor that influences number, frequency and type of GCs taking 
> place.

Yeah, that's the annoying thing about it.  If nothing else, we could
levarage this fact by putting (gc #f) in the set-finalizer! procedure.
This seemed to make the errors go away, as well.  This feels like
sweeping the underlying problem under the rug, though (I feel the same
way about the change that allows only a fixed number of finalizers)

> You can try using a fixed heap (say, using "-:h500m") - does that make
> a difference? (the test seems to run ok on my machine).

Yes, it does not give any error with -:h500m, just like when I pass
-:hg250 or higher.

"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

reply via email to

[Prev in Thread] Current Thread [Next in Thread]