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

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

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.


#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])

Posted on the users mailing list.