From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: scm_must_realloc mallocated count in 1.6 Date: Mon, 20 Mar 2006 09:46:06 +1100 Message-ID: <8764ma6ok1.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1142808407 31771 80.91.229.2 (19 Mar 2006 22:46:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 19 Mar 2006 22:46:47 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Mar 19 23:46:45 2006 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FL6fZ-0003Mt-8D for guile-devel@m.gmane.org; Sun, 19 Mar 2006 23:46:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FL6fY-00059P-SR for guile-devel@m.gmane.org; Sun, 19 Mar 2006 17:46:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FL6fV-00059A-MR for guile-devel@gnu.org; Sun, 19 Mar 2006 17:46:37 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FL6fU-00058y-37 for guile-devel@gnu.org; Sun, 19 Mar 2006 17:46:37 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FL6fT-00058v-WD for guile-devel@gnu.org; Sun, 19 Mar 2006 17:46:36 -0500 Original-Received: from [61.8.0.115] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FL6kt-0001iO-Vr for guile-devel@gnu.org; Sun, 19 Mar 2006 17:52:12 -0500 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout2.pacific.net.au (Postfix) with ESMTP id BD7746F28A for ; Mon, 20 Mar 2006 09:46:26 +1100 (EST) Original-Received: from localhost (ppp2628.dyn.pacific.net.au [61.8.38.40]) by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id k2JMkPvb022437 for ; Mon, 20 Mar 2006 09:46:26 +1100 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1FL6f1-0004Ve-00; Mon, 20 Mar 2006 09:46:07 +1100 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5792 Archived-At: There's a bit of a bug in scm_must_realloc and its scm_mallocated counting in 1.6. If you tell scm_must_realloc to decrease the size of a block, it doesn't change scm_mallocated count, so when you later report the new size in the free, the final scm_mallocated is off by the difference (ie. bigger than it should be). This occurs in the core with bignums when scm_i_adjbig trims off excess digits from the end of a block. It might happen with applications, though perhaps realloc to decrease isn't too common. A little loop that shows the problem is (while #t (ash 1 256) (gc) (pk (assq-ref (gc-stats) 'bytes-malloced))) The count printed keeps going up. I'm inclined to remove the short-circuit if (size <= old_size) return where; from scm_must_realloc, ie. if you ask to decrease a block then actually do it, which is what 1.8 has now. The alternative would be to leave no realloc() on decrease, but do adjust scm_mallocated. That would mean scm_mallocated doesn't reflect the amount of malloc actually in use, which wouldn't be a good thing for the mtrigger stuff. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel