unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Abhijeet More <abhijeet.more@gmail.com>
Cc: "Ludovic Courtès" <ludo@gnu.org>,
	guile-user@gnu.org,
	"Tibi Turbureanu" <tiberiuturbureanu@gmail.com>
Subject: Re: Possible Memory Leak with stream-for-each
Date: Sat, 31 Jul 2010 13:48:27 +0200	[thread overview]
Message-ID: <m3iq3vg9dg.fsf@unquote.localdomain> (raw)
In-Reply-To: <AANLkTik0SSM12==nfyEHcUudO5esB+5aPxoZ19B4gN0-@mail.gmail.com> (Abhijeet More's message of "Thu, 29 Jul 2010 20:38:30 -0400")

Hi Abhijeet,

On Fri 30 Jul 2010 02:38, Abhijeet More <abhijeet.more@gmail.com> 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/



  reply	other threads:[~2010-07-31 11:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-19 18:08 Possible Memory Leak with stream-for-each Abhijeet More
2010-07-20 20:36 ` Andy Wingo
2010-07-21  7:00   ` Tristan Colgate
2010-07-24 16:13 ` Ludovic Courtès
2010-07-24 16:32   ` Abhijeet More
2010-07-24 16:46     ` Abhijeet More
2010-07-26  9:36       ` Andy Wingo
2010-07-30  0:38         ` Abhijeet More
2010-07-31 11:48           ` Andy Wingo [this message]
2010-07-31 20:16             ` Abhijeet More
2010-08-11 16:57               ` Abhijeet More
2010-08-02  3:29             ` Tibi Turbureanu
2010-08-15 15:12             ` Heap profiler Ludovic Courtès
2010-09-02 12:49 ` Possible Memory Leak with stream-for-each Ludovic Courtès
2010-09-02 16:20   ` Julian Graham
2010-09-02 18:46   ` Andy Wingo

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=m3iq3vg9dg.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=abhijeet.more@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=ludo@gnu.org \
    --cc=tiberiuturbureanu@gmail.com \
    /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).