This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
conservative scanning and infinite streams
- To: guile at sourceware dot cygnus dot com
- Subject: conservative scanning and infinite streams
- From: Ole Myren Rohne <ole dot rohne at cern dot ch>
- Date: Fri, 24 Mar 2000 17:32:56 +0100 (CET)
I'd like to use very long streams, but it a steady growing heap makes
this impractical.
Instrumenting gc.c, I have convinced myself that the c stack is
holding on to the garbage. As my knowledge of gc is very shallow, I
have no idea why this happens. Naively, it should be possible to
ensure constant heap as well as constant stack?
Do I have any option but rewriting my streams in loop style?
Thank you for any suggestion,
Ole Myren Rohne
--- Silly example ---
(use-modules (ice-9 streams))
(define (stream-iota n)
(make-stream
(lambda (i)
(if (= i n)
'()
(cons i (+ i 1))))
0))
(stream-for-each
(lambda (i)
(and (= (remainder i 1000) 0)
(display (gc-stats))
(newline)))
(stream-iota -1))