From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: Possible Memory Leak with stream-for-each Date: Sat, 31 Jul 2010 13:48:27 +0200 Message-ID: References: <87iq44yi1q.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1280576756 28338 80.91.229.12 (31 Jul 2010 11:45:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 31 Jul 2010 11:45:56 +0000 (UTC) Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , guile-user@gnu.org, Tibi Turbureanu To: Abhijeet More Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Jul 31 13:45:54 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OfAVk-0002KW-O8 for guile-user@m.gmane.org; Sat, 31 Jul 2010 13:45:53 +0200 Original-Received: from localhost ([127.0.0.1]:49300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OfAVj-0007GO-ME for guile-user@m.gmane.org; Sat, 31 Jul 2010 07:45:51 -0400 Original-Received: from [140.186.70.92] (port=40306 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OfAVe-0007F3-PC for guile-user@gnu.org; Sat, 31 Jul 2010 07:45:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OfAVd-0004rm-LM for guile-user@gnu.org; Sat, 31 Jul 2010 07:45:46 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:33446 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfAVd-0004rV-JY; Sat, 31 Jul 2010 07:45:45 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 5EF1EC804E; Sat, 31 Jul 2010 07:45:44 -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; s=sasl; bh=iKNKkpEFHtjBbzhHoPgEuj86nZ4=; b=ehRgBo vGe3pl5QfbvSznxQJdZHTEaapZcWGYr1Se9cFQq1jfB039HaGwZ4k5Vyz+eWgDc5 5+/iPzQNRSD6ZPsTWm8AlLnZJ8q9+/0NAjO/NyFn8s4ais4pD1nGcekaDBcuCjZj l9mxcpRYl844d9ojFrLKUr5N0SEmlgzlVBynY= 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; q=dns; s=sasl; b=SMOWPd47X6lMvgfJiGzGyIVtByqrKTFR +13y1nemD3kQt9GuXiVpTqB7GCMNzrhTt1x9k7URq/F5MbSd+ad8aF+V+PfWg71Z PBPjgvF/4HDUMB3bo/jZndoMLoizSC1e8rgQS4XGehlu9b4r4weDWVWyDZaP55qT 1iYZCd86l2I= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 20032C804A; Sat, 31 Jul 2010 07:45:41 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [88.17.204.243]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 188B5C8041; Sat, 31 Jul 2010 07:45:36 -0400 (EDT) In-Reply-To: (Abhijeet More's message of "Thu, 29 Jul 2010 20:38:30 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 2518EB6A-9C99-11DF-994B-9056EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8042 Archived-At: Hi Abhijeet, On Fri 30 Jul 2010 02:38, Abhijeet More writes: > To debug this further are there any useful places in the > stream-for-each implementation that I could do a gc-stats from? Or > would we need to look at the C implementation? > > Can anyone suggest good starting points for this? We started poking this a little at the GNU Hackers Meeting last weekend. I say "we" but it was really Tibi (copied on the mail) who was doing most of the work. We printed out the object-address of the stream at the start of the iteration, then ctrl-C'd in GDB somewhere in the middle. We then called GC_print_heap_obj on that address and it printed as a two-word object. We scm_display'd the address, and it was not a stream. (It was used for something else.) So, it's not the case that the beginning of the stream was being held on to. Which is a bad thing -- it means that somehow something in the middle was being held on to. To really track this down we need a heap profiler. To make a heap profiler, we need to hack libgc. libgc has some of the things we need already, but some are only present in debug builds, which is ridiculous -- one should always have the ability to profile the heap. We need to figure out which value is being misidentified as a pointer to a heap-allocated stream-pair. That is my analysis anyway. The next step is to be able to expose the back-pointer graph from libgc, and write analysis tools to figure out which non-stream objects point to a stream. Andy -- http://wingolog.org/