karme | 26 Jan 11:33
Picon

stream question / unbound memory?

Hi,

why does the following example seem to need unbound memory?

sh$ { cat << EOF
#!/bin/sh
#|
GC_PRINT_STATS=1
export GC_PRINT_STATS
exec gosh -- "\$0" "\$@"
|#

(use util.stream)

(define (main args)
  (stream-for-each (lambda(x)
                     (write x)
                     (newline))
                   (port->stream (current-input-port) read))
  0)
EOF
} > test.scm \
&& chmod +x test.scm \
&& seq 10000000\
|./test.scm 2>&1 > /dev/null \
| grep --line-buffered heapsize |cut -f 2 -d ">"

output should be something like:
heapsize = 262144 bytes
heapsize = 786432 bytes
heapsize = 2502656 bytes
heapsize = 3338240 bytes
[...]
heapsize = 44535808 bytes
heapsize = 44535808 bytes
heapsize = 59383808 bytes

greetings,
karme

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d

Gmane