[plt-scheme] Debugging non-scheme-heap memory leaks

From: David Brown (plt at davidb.org)
Date: Sat Jan 2 13:16:12 EST 2010

On Sat, Jan 02, 2010 at 09:17:32AM -0800, David Brown wrote:
>On Fri, Jan 01, 2010 at 11:37:11PM -0800, David Brown wrote:
>
>>I have a program that basically does a bunch of computation and reads
>>and writes data to binary files.  I believe I've eliminated anything
>>involving FFI, but I'm still finding a memory leak.
>
>I've narrowed the leak down to the following code.  The culprit seems
>to be the generator.  It also seems that generators are very slow.
>I'm going to rewrite my code to explicitly use make-do-sequence, which
>hopefully should avoid this issue.

And a little extra information.  This is on x86_64.  It does not
appear to leak on x86, and the leak goes away if I disable JIT.

Welcome to MzScheme v4.2.3 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.

Right now, I'm using the Arch binary package, but I'm building it
myself as well.

David

>David
>
>#lang scheme
>
>(require scheme/generator)
>
>(define (leaky)
>  (for ([file (in-range 135)])
>    (let ([gen (in-generator (for ([i (in-range 37000)])
>			       (yield 42)))])
>      (for ([item gen])
>	(void)))))
>(leaky)
>_________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.