GNU bug report logs -
#42013
26.3; hash tables are not garbage collected
Previous Next
Reported by: Hendrik Tews <hendrik.tews <at> kernkonzept.com>
Date: Mon, 22 Jun 2020 23:47:02 UTC
Severity: normal
Found in version 26.3
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 42013 <at> debbugs.gnu.org (full text, mbox):
Hendrik Tews <hendrik.tews <at> kernkonzept.com> writes:
> What am I doing wrong that prevents the third call to
> garbage-collect to garbage collect the hash and the uninterned
> symbol?
(let (gc-start gc-state hash result)
;; record gc statistics
(setq gc-start (garbage-collect))
(setq hash (make-hash-table))
(setq gc-state (garbage-collect))
(push (list 'vec1 (- (caddr (assoc 'vectors gc-state))
(caddr (assoc 'vectors gc-start))))
result)
;; make the hash inaccessible
(setq hash nil)
(setq gc-state (garbage-collect))
(push (list 'vec2 (- (caddr (assoc 'vectors gc-state))
(caddr (assoc 'vectors gc-start))))
result)
result)
I've simplified the test case. As the bug submitter says, there's more
vectors after this than before:
((vec2 5) (vec1 5))
But I'm not sure you can use this data in this fine-grained way. For
instance:
(let (gc-start gc-state hash result)
;; record gc statistics
(setq gc-start (garbage-collect))
;;(setq hash (make-hash-table))
(setq gc-state (garbage-collect))
(push (list 'vec1 (- (caddr (assoc 'vectors gc-state))
(caddr (assoc 'vectors gc-start))))
result)
;; make the hash inaccessible
(setq hash nil)
(setq gc-state (garbage-collect))
(push (list 'vec2 (- (caddr (assoc 'vectors gc-state))
(caddr (assoc 'vectors gc-start))))
result)
result)
=> ((vec2 0) (vec1 0))
Sounds good.
(let (gc-start gc-state hash result)
;; record gc statistics
(setq gc-start (garbage-collect))
(make-hash-table)
(setq gc-state (garbage-collect))
(push (list 'vec1 (- (caddr (assoc 'vectors gc-state))
(caddr (assoc 'vectors gc-start))))
result)
;; make the hash inaccessible
(setq hash nil)
(setq gc-state (garbage-collect))
(push (list 'vec2 (- (caddr (assoc 'vectors gc-state))
(caddr (assoc 'vectors gc-start))))
result)
result)
=> ((vec2 -1) (vec1 4))
Uhmn...
So I'm not sure there's anything to fix here, except perhaps noting in
the doc string that you can't do precision math on the numbers? Anybody?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 3 years and 243 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.