emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#9900: closed (Using a guardian on a value in a wea


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#9900: closed (Using a guardian on a value in a weak hash)
Date: Wed, 09 Nov 2011 22:48:02 +0000

Your message dated Wed, 09 Nov 2011 23:47:04 +0100
with message-id <address@hidden>
and subject line Re: bug#9900: Using a guardian on a value in a weak hash
has caused the debbugs.gnu.org bug report #9900,
regarding Using a guardian on a value in a weak hash
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
9900: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9900
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Using a guardian on a value in a weak hash Date: Fri, 28 Oct 2011 21:42:45 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Hi guilers,

If I 'guard' a value, and store it in a weak-key hashtable, then it
doesn't appear in the guardian even after it is removed from the
weak-hash by a garbage collection. Note, this only happens in a
_script_, and will work fine in a REPL (you should only need two GCs,
one for the weak hash, and one for the now free value).
e.g.


(define guardian (make-guardian))
(define finalizer-table (make-weak-key-hash-table))

(let ((f (lambda () (display "test\n"))))
  (guardian f)
  (hashq-set! finalizer-table (cons #f #f) f)
  #f)

(write finalizer-table)
(newline)

(gc)(gc)(gc)(gc)(gc)(gc)(gc)(gc)(gc)(gc)(gc)(gc)

(write finalizer-table)
(newline)

(write (guardian))
(newline)


will produce the output


address@hidden guile]$ guile -s /tmp/gcbug.scm 
#<weak−key−hash−table 1/31>
#<weak−key−hash−table 0/31>
#f
address@hidden guile]$ 

-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"




--- End Message ---
--- Begin Message --- Subject: Re: bug#9900: Using a guardian on a value in a weak hash Date: Wed, 09 Nov 2011 23:47:04 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
I believe I have fixed this bug in stable-2.0.  Thanks for the report!

Andy
-- 
http://wingolog.org/


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]