[Ecls-list] Consing statistics?

Juan Jose Garcia-Ripoll jjgarcia at users.sourceforge.net
Sat Dec 23 23:18:50 UTC 2006


2006/12/24, Dave Roberts <dave at vyatta.com>:
> I'm not sure I understand the difference? The other patch is only
> "inaccurate" if the timed form allocates more than 4 GB of memory.

The current patch uses bignums to store the amount of reserved memory,
if required. On every garbage collection it increments a counter which
is a lisp integer adding the amount of bytes which were allocated
between garbage collections.

Your patch is not safe if the function allocates more than 4GB within
the TIME call, or if the C counter wraps around within the TIME
routine.

> Otherwise, it is accurate. Are you just keeping more than 32-bit
> precision somewhere, modifying the local copy of the Boehm code?

No changes to the Boehm code yet. Before every garbage collection we
inspect a variable (GC_words_allocd) that counts the number of words
allocated since the last garbage collection. This is added to a lisp
integer, which at some point may become a bignum.

Since creating bignums itself "conses", the counter is reset when
entering a timed piece of code, and deactivated by setting
cl_object.bytes_consed = OBJNULL afterwards. This is, in my opinion,
better than what SBCL does: updates a bignum on every GC.

> Is there any reason you removed the count of GCs, which I also find
> helpful? The consing is helpful to determine if a form is generating a
> lot of memory.

The reason I did not add a GC count is because I wanted to make sure
this works first. Now it is possible to add other statistics to the GC
entry point and I will add also a hook to the garbage collector for
including a timer.

The only problem is that I have just realized I forgot running
autoconf on the directory "src/" so the consing counter is probably
not activated by default. I will fix this tomorrow, if I remember it.

Juanjo

-- 
Dpto. de Fisica Teorica I, Fac. de CC Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 2804 (Spain)
http://teorica.fis.ucm.es/~jjgarcia/




More information about the ecl-devel mailing list