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: Fri, 02 Dec 2011 12:10:55 +0100 Message-ID: <874nxj8c00.fsf@pobox.com> References: <87tycaodlk.fsf@netris.org> <87k4d6edvr.fsf@gnu.org> <8739jue9wk.fsf@neil-laptop.ossau.uklinux.net> <87zkfh9x8r.fsf@pobox.com> <8762i5mf4x.fsf@gnu.org> 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 1322824274 15374 80.91.229.12 (2 Dec 2011 11:11:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 2 Dec 2011 11:11:14 +0000 (UTC) Cc: guile-devel@gnu.org, Neil Jerram To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Dec 02 12:11:10 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 1RWR1I-0006xx-Iy for guile-devel@m.gmane.org; Fri, 02 Dec 2011 12:11:09 +0100 Original-Received: from localhost ([::1]:46526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWR1H-0000L4-SE for guile-devel@m.gmane.org; Fri, 02 Dec 2011 06:11:07 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:42867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWR1F-0000Hz-3z for guile-devel@gnu.org; Fri, 02 Dec 2011 06:11:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWR1A-0007gD-Ps for guile-devel@gnu.org; Fri, 02 Dec 2011 06:11:05 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:42412 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWR1A-0007ff-MN; Fri, 02 Dec 2011 06:11:00 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id D43786044; Fri, 2 Dec 2011 06:10:59 -0500 (EST) 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=BdMQfxNbNRVX TBfC+dJ91iZJHZI=; b=t/mrD1jtxZKY3aR64ojmO6/yE6K3Vx/7cMhrTV3Ko/TD r9ZELGstLeLNQr+eS58S0cC6IQhr3t425M5ebi5e+sDrfF7w4BDGe40PKeqJvN6O aqSBEph1lQFw+e/xg7aFXSOiBReJyZpIW1UmYTsZMWV9fQLu54c2w4pbcZHE8y8= 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=nHuh6R 0vd0fY3EJQfBN4VsZR6G4c6Ps+Wjcw4J+93pwmKtJpriizFfJXBWwlS8SaC4C+8A peN8BSCvSWr+Px5dzsVnDtJgTg+uAdyb1iI7WRKk8CDkD7kr1jc5JEI1Rre8DO8p GX4lwtnCcMXiiFrCN+m1675JbuBzBjILfgims= 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 CD8C46043; Fri, 2 Dec 2011 06:10:59 -0500 (EST) Original-Received: from badger (unknown [91.117.99.155]) (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 510006042; Fri, 2 Dec 2011 06:10:59 -0500 (EST) In-Reply-To: <8762i5mf4x.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sun, 27 Nov 2011 22:25:50 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Pobox-Relay-ID: 505C5E24-1CD6-11E1-B1FD-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 74.115.168.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:12951 Archived-At: On Sun 27 Nov 2011 22:25, ludo@gnu.org (Ludovic Court=C3=A8s) 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. I made scm_realloc call scm_gc_register_allocation. I also installed custom gmp allocators that call scm_malloc and friends -- so the same allocators, but instrumented. (Because we hard-coded `free' already in the printer, we know that this shouldn't break anything.) 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. Andy --=20 http://wingolog.org/