[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: Ludovic Courtès
Subject: Re: [PATCH] Configure GMP to use GC allocation functions, remove bignum finalizers
Date: Fri, 02 Dec 2011 18:02:07 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux)


Andy Wingo <address@hidden> skribis:

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

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!


reply via email to

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