[Top][All Lists]

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

cell heap usage in 1.8 vs 1.6

From: Kevin Ryde
Subject: cell heap usage in 1.8 vs 1.6
Date: Fri, 17 Aug 2007 10:28:35 +1000
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

I'm having trouble in my charting program with the amount of heap space
allocated for cells in 1.8.  It ends up allocating more and more heap
(as reported by gc-stats 'cell-heap-segments and confirmed by
mallinfo()), apparently without bound.  I've got between 150k and 200k
objects according to gc-live-object-stats, which should be about 5Mb of
cells, but the heap keeps growing to as much as 60Mb.

The same code seems ok in 1.6, it lives happily in about 5Mb of heap,
though it does seem to do a few more gc's than 1.8.  A backport of
gc-live-object-stats to 1.6 says the objects in use are about the same

I stuck in lots of printfs, which haven't told me much so far, except
that the "collected" counts seem to be lower than I'd expect, and cause
min_yield to be increased, and the heap then added to (every few gc's).

Should the collected counts end up basically as "heapsize - liveobjects"
every time?  They seem to be smaller than that, but I don't know where
to look for how or why.  scm_i_sweep_segment() looks slightly doubtful.
Does it deliberately not count the balance of a lazy sweep towards the
collected counts?  I wondered if a gc is provoked by the double cells
being exhausted but only a little of the single cells having been
collected, leaving a small collected count in the latter (or vice

Alas I don't have a simple program to provoke the problem.  Perhaps some
other big or long run program users could look at their heap consumption
vs live objects, to see if it's just me.

(define (total-heap)
  (apply + (map (lambda (elem)
                  (abs (- (cdr elem) (car elem))))
                (assoc-ref (gc-stats) 'cell-heap-segments))))

(define (count-alive)
  (apply + (map cdr (gc-live-object-stats))))

reply via email to

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