[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: |
Wed, 01 Jun 2011 10:34:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hey folks,
Thanks for the debugging and the patch, Mark!
On Wed 01 Jun 2011 01:18, Neil Jerram <address@hidden> writes:
> address@hidden (Ludovic Courtès) writes:
>
>> Mark H Weaver <address@hidden> skribas:
>>
>>> The main reason I haven't already pushed this patch is that there is a
>>> slight complication: when you register custom allocation functions for
>>> use by GMP, they get used for _all_ allocation, not just for digits. In
>>> particular, they get used to allocate the block returned by mpz_get_str
>>> (when the first argument is NULL). This means that if the user of
>>> mpz_get_str uses the standard "free" to deallocate this block, it will
>>> fail badly. This could potentially affect programs which use libguile
>>> but also use the GMP functions directly.
>>
>> Yes, that's a problem, probably even be a showstopper for 2.0. :-(
>>
>> What do others think?
>
> Provide an API to allow the trade-off to be decided by the application
> developer?
I think this only makes sense as an interim measure, like if we want to
change GMP to allocate only via GC_malloc in 2.2, then provide the
option in 2.0. There has to be a better long-term solution though.
What if we get libgc to track total heap size (whether the user has
malloc, g_slice_alloc, or whatever), and start doing GC more frequently
if it sees the total heap size going up?
Andy
--
http://wingolog.org/
- Re: [PATCH] Configure GMP to use GC allocation functions, remove bignum finalizers,
Andy Wingo <=