[plt-scheme] v372: Uncollectable Scheme memory (even with sandbox.ss)

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri May 2 17:09:49 EDT 2008

At Wed, 30 Apr 2008 12:19:07 -0600, Matthew Flatt wrote:
> At Tue, 29 Apr 2008 14:01:04 -0400, "Eric Kidd" wrote:
> > Over the past several years, we've been wrestling with a memory leak
> > in Halyard. This leak appears to occur in the Scheme heap, and we
> > haven't been able to control it using either custodians or sandboxes.
> > 
> > [...]
> > 
> > We're pretty much at a loss here. Is there anything else we should
> > try? Are there any other statistics we should take a look at?

For the record, we tracked this down to a problem with sharing the
output and error port across sandbox invocations. Sharing the port
directly turns out to be a bad idea, because a program in a sandbox can
attach a `display' or `print' handler to the port. (And it turns out
that Swindle sets the handlers while chaining to the old ones, which
created a bridge between sandbox invocations.)

I'm adding `dup-input-port' and `dup-output-port' to `scheme/port', so
that you can pass along a port to a sandbox that reads/writes from/to
an existing port without allowing changes to the existing port's


Posted on the users mailing list.