Hello!

Andy Wingo <wi...@pobox.com> skribis:

> On Sun 27 Nov 2011 22:25, l...@gnu.org (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.

OK, sounds good.  I guess scm_gc_register_collectable_memory could be
changed to just call it, ignoring its first argument?

> I made scm_realloc call scm_gc_register_allocation.  I also installed
> custom gmp allocators that call scm_malloc and friends

I was about to say “we can’t do that in 2.0!”, but then saw your
scm_install_gmp_memory_functions trick.  Cool!  :-)

Could you make it SCM_INTERNAL instead of SCM_API?

> 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.

Could you check how it affects gc-benchmarks/?  :-)

Thank you for being both an efficient and a brave hacker!

Ludo’.

Reply via email to