From: Neil Jerram <neil@ossau.uklinux.net>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] Configure GMP to use GC allocation functions, remove bignum finalizers
Date: Wed, 01 Jun 2011 00:18:51 +0100 [thread overview]
Message-ID: <8739jue9wk.fsf@neil-laptop.ossau.uklinux.net> (raw)
In-Reply-To: <87k4d6edvr.fsf@gnu.org> ("Ludovic Courtès"'s message of "Tue, 31 May 2011 23:52:56 +0200")
ludo@gnu.org (Ludovic Courtès) writes:
> Hi!
>
> Mark H Weaver <mhw@netris.org> 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
next prev parent reply other threads:[~2011-05-31 23:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-31 19:48 [PATCH] Configure GMP to use GC allocation functions, remove bignum finalizers Mark H Weaver
2011-05-31 20:07 ` Mark H Weaver
2011-05-31 21:52 ` Ludovic Courtès
2011-05-31 23:18 ` Neil Jerram [this message]
2011-05-31 23:32 ` Neil Jerram
2011-06-01 8:34 ` Andy Wingo
2011-06-02 23:14 ` Ludovic Courtès
2011-11-27 19:33 ` Andy Wingo
2011-11-27 21:25 ` Ludovic Courtès
2011-11-28 22:23 ` Andy Wingo
2011-11-28 23:10 ` Ludovic Courtès
2011-11-28 23:50 ` Andy Wingo
2011-11-29 11:06 ` Ludovic Courtès
2011-11-29 11:35 ` Andy Wingo
2011-11-29 13:20 ` Ludovic Courtès
2011-11-29 12:45 ` Andy Wingo
2011-11-29 13:18 ` Ludovic Courtès
2011-11-29 14:44 ` Andy Wingo
2011-11-29 16:22 ` Ludovic Courtès
2011-12-02 11:10 ` Andy Wingo
2011-12-02 17:02 ` Ludovic Courtès
2011-12-02 18:12 ` Andy Wingo
2011-12-02 22:17 ` Ludovic Courtès
2011-12-03 10:57 ` Andy Wingo
2011-12-03 17:57 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8739jue9wk.fsf@neil-laptop.ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
--cc=guile-devel@gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).