guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Configure GMP to use GC allocation functions, remove bignum


From: Neil Jerram
Subject: Re: [PATCH] Configure GMP to use GC allocation functions, remove bignum finalizers
Date: Wed, 01 Jun 2011 00:18:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> Hi!
>
> 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?

The application developer would know if they were using GMP other than
via Guile, and in that case they'd choose to have GMP use GC
allocation.  Alternatively they might know that their application's use
of GMP/Guile was not such as to generate lots of GMP garbage as the
factorial example does, and so choose to use normal malloc.

Of course, that's only if there really is no more perfect solution here.

      Neil



reply via email to

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