This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: conservative scanning and infinite streams
Jim Blandy writes:
> Are you *sure* the "garbage" is really garbage? It looks to me like
> stream-fold, used by stream-for-each, is written (probably
> accidentally) so that it holds onto the initial stream until it returns.
>
> Have you tried rewriting your code without using stream-for-each?
No, I am not sure it is really garbage... The simplest case gives
inconsistent results on i586-pc-linux-gnu and sparc-sun-solaris2.6.
Silly test program:
(use-modules (ice-9 streams))
(do ((str (make-stream (lambda (i)
(cons i (+ i 1)))
0)
(stream-cdr str)))
((stream-null? str))
(and (= 0 (remainder (stream-car str) 10000))
(gc)
(display (gc-stats) (current-error-port))
(newline (current-error-port))))
On i586-pc-linux-gnu, cells-allocated is stuck at 67 (bug?) while
gc-time-taken increase at a constant rate per cycle. On
sparc-sun-solaris2.6, cells-allocated starts around 30000, increases
gradually up to 300000, jumps back to 30000 a few times and eventually
it seems to increase without bound (now at 4500000)
Regards, Ole