From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Configure GMP to use GC allocation functions, remove bignum finalizers Date: Wed, 01 Jun 2011 10:34:42 +0200 Message-ID: References: <87tycaodlk.fsf@netris.org> <87k4d6edvr.fsf@gnu.org> <8739jue9wk.fsf@neil-laptop.ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1306917332 17514 80.91.229.12 (1 Jun 2011 08:35:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 1 Jun 2011 08:35:32 +0000 (UTC) Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , guile-devel@gnu.org To: Neil Jerram Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jun 01 10:35:27 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QRgtf-0001Du-BZ for guile-devel@m.gmane.org; Wed, 01 Jun 2011 10:35:23 +0200 Original-Received: from localhost ([::1]:58863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRgte-0006FR-6J for guile-devel@m.gmane.org; Wed, 01 Jun 2011 04:35:22 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRgtC-0006FE-DG for guile-devel@gnu.org; Wed, 01 Jun 2011 04:34:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRgtA-0000Ed-54 for guile-devel@gnu.org; Wed, 01 Jun 2011 04:34:54 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:37786 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRgt9-0000EZ-VL; Wed, 01 Jun 2011 04:34:52 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 07BFF454C; Wed, 1 Jun 2011 04:36:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=7JFbioWTFjN/ +29+bqq2YhAjngQ=; b=QSRDVt9QT5FLI/mTlWHP8EB726b4GXLpXHNlHa6qLh6n X4LFxSMGHllaoTJLCRxxUuZ1+jjbgdJMkH2w3muUdlDXAaREWZQXH16QpfLP/FDP fsTQA4l8F3jvRmPcep2qdAzGSGEYdxm5l7vwNUV5v6KXaNFo2RrQUJKFL9yKaSU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=BrkZqw zOrEC48WQ2RWTvaQeEhCrWnlvjcgX7QQelBE8TpdqnrgwIml75jH95mc9tbJehZQ 9tGA4L6+PTSYdKophWQ+GpeS94jVmz/3LBihxkP8f+/Kyxwv5NmhZWiPnJXRolrU sGsE35xzcoqGHKoZsI+6TVnjoo8PLK9ONwXkE= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id D9395454B; Wed, 1 Jun 2011 04:36:56 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id DAC6F454A; Wed, 1 Jun 2011 04:36:53 -0400 (EDT) In-Reply-To: <8739jue9wk.fsf@neil-laptop.ossau.uklinux.net> (Neil Jerram's message of "Wed, 01 Jun 2011 00:18:51 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 4F4C5EF4-8C2A-11E0-ACA5-D6B6226F3D4C-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12561 Archived-At: Hey folks, Thanks for the debugging and the patch, Mark! On Wed 01 Jun 2011 01:18, Neil Jerram writes: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Mark H Weaver 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 --=20 http://wingolog.org/