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

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Jan 2 13:01:14 EST 2010

Can you say more about how you're running this program an measuring
memory use?

When I run directly in MzScheme, it takes about 2 minutes --- yes,
generators can be relatively slow --- but memory use is stable at 22MB.
when I run in DrScheme with debugging enabled, it takes about 3
minutes, and memory use still seems to be stable (around 120MB for the
whole DrScheme process). I'm running on x86 Mac OS X.

Thanks,
Matthew

At Sat, 2 Jan 2010 09:17:32 -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.
> 
> 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)



Posted on the users mailing list.