[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Configure GMP to use GC allocation functions, remove bignum
From: |
Andy Wingo |
Subject: |
Re: [PATCH] Configure GMP to use GC allocation functions, remove bignum finalizers |
Date: |
Fri, 02 Dec 2011 12:10:55 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
On Sun 27 Nov 2011 22:25, address@hidden (Ludovic Courtès) writes:
> A longer term option may be to augment libgc with something akin to our
> old scm_gc_register_collectable_memory.
This is also necessary, as it turns out. I added
scm_gc_register_allocation, which will simply run a GC every so often.
Currently the heuristic is that when GC runs, a counter is reset to be
equal to the current GC heap size. scm_gc_register_allocation(size_t)
decrements this counter. When it wraps around, we run GC.
I made scm_realloc call scm_gc_register_allocation. I also installed
custom gmp allocators that call scm_malloc and friends -- so the same
allocators, but instrumented. (Because we hard-coded `free' already in
the printer, we know that this shouldn't break anything.)
That makes the `(factorial 100000)' test take twice as long to run (6
seconds vs 3 seconds), because GC ran 1000 times instead of 15 times,
but it kept the memory image size to 18 MB instead of 1800 MB.
Andy
--
http://wingolog.org/
- Re: [PATCH] Configure GMP to use GC allocation functions, remove bignum finalizers,
Andy Wingo <=