This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

conservative scanning and infinite streams


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))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]