[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stream-filter and space leaks



   From: Matthias Neubauer <neubauer@xxxxxxxxxxxxxxxxxxxxxxxxxx>
   Date: 25 Feb 2003 17:01:34 +0100

   I, for my part, downloaded the current reference implementation as
   found on http://srfi.schemers.org/srfi-40/srfi-40.txt. The only thing
   that I then changed was that I replaced the former version of
   STREAM-FILTER by the one Phil posted last Thursday. When I load this
   into my scsh (0.6.3) and evaluate

   (stream-car (stream-filter (lambda (x) (zero? x)) (stream-from 1)))

   the whole thing dies pretty soon ejecting a post-gc interrupt---i.e,
   scsh seems to run out of memory.

For me, using Scheme 48 version 0.57, the current reference implemenation
leaks for

   (stream-car (stream-filter (lambda (x) (zero? x)) (stream-from 1)))

Using either or both the new stream-filter or the non-reentrant promises
fixes the problem.

Our different experiences may be based on differences between the 0.57 and
the Scheme 48 version underlying Scsh 0.6.3.  I don't know which version
that is.

   The only thing I am not sure about is, if STREAM-UNFOLDN is the right
   abstraction to transform streams (it looks a little bit too "heavy
   weight" to me ...).

It certainly isn't a polished result.  Most of the goofiness comes from
wanting to be able to convert N input streams into M output streams.
It might be simpler to have three functions that handle N->1, 1->1, and
1->N conversions.  Perhaps having all four would be the most useful thing
to do.

It's a bit hard to tell what your stream-transform is doing.  Can you 
explain it?  Or give a type?
                                             -Richard Kelsey