From: Lars Ingebrigtsen <larsi@gnus.org>
To: Hendrik Tews <hendrik.tews@kernkonzept.com>
Cc: 42013@debbugs.gnu.org
Subject: bug#42013: 26.3; hash tables are not garbage collected
Date: Sat, 17 Oct 2020 12:52:40 +0200 [thread overview]
Message-ID: <87a6wlt98n.fsf@gnus.org> (raw)
In-Reply-To: <87zh8uwxn3.fsf@cert.kernkonzept.com> (Hendrik Tews's message of "Tue, 23 Jun 2020 00:20:32 +0200")
Hendrik Tews <hendrik.tews@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
next prev parent reply other threads:[~2020-10-17 10:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 22:20 bug#42013: 26.3; hash tables are not garbage collected Hendrik Tews
2020-10-17 10:52 ` Lars Ingebrigtsen [this message]
2020-10-21 12:47 ` Hendrik Tews
2020-10-22 11:22 ` Lars Ingebrigtsen
2020-10-22 12:14 ` Andreas Schwab
2020-10-22 15:15 ` Hendrik Tews
2021-09-16 15:13 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a6wlt98n.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=42013@debbugs.gnu.org \
--cc=hendrik.tews@kernkonzept.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).