In guile 1.6.1 or the cvs on a recent i386 debian, I noticed that
doing a display of a weak key hash table can seemingly prevent a key
from being garbage collected.  For instance

        (define h (make-weak-key-hash-table 7))

        (define k "mykey")
        (hash-set! h (string-copy k) 12345)

        (display (hash-ref h k)) (newline)
        (display h) (newline)
        (gc)
        (display (hash-ref h k)) (newline)

run with "guile -s foo.scm" produces

        12345
        #wh(() () () () () ((mykey . 12345)) ())
        12345

whereas I might have expected the gc to have collected the entry just
set, making the second hash-ref give #f rather than 12345.  This is
what happens if the (display h) is not present.

I don't really know if this is a bug, or ignorance on my part, but it
seemed more than a little strange.


_______________________________________________
Bug-guile mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-guile

Reply via email to