GNU bug report logs - #42013
26.3; hash tables are not garbage collected

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Hendrik Tews <hendrik.tews@HIDDEN>; dated Mon, 22 Jun 2020 23:47:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 42013 <at> debbugs.gnu.org:


Received: (at 42013) by debbugs.gnu.org; 22 Oct 2020 15:15:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 22 11:15:36 2020
Received: from localhost ([127.0.0.1]:53526 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kVcJT-0002jI-RG
	for submit <at> debbugs.gnu.org; Thu, 22 Oct 2020 11:15:36 -0400
Received: from serv1.kernkonzept.com ([159.69.200.6]:44967
 helo=mx.kernkonzept.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <hendrik.tews@HIDDEN>) id 1kVcJR-0002j2-8e
 for 42013 <at> debbugs.gnu.org; Thu, 22 Oct 2020 11:15:33 -0400
Received: from ip5f5a64b2.dynamic.kabel-deutschland.de ([95.90.100.178]
 helo=cert)
 by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) id 1kVcJQ-0005X4-8D; Thu, 22 Oct 2020 17:15:32 +0200
Received: from localhost ([::1] helo=cert)
 by cert with esmtps  (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
 (Exim 4.94) (envelope-from <hendrik.tews@HIDDEN>)
 id 1kVcJP-000DqW-BI; Thu, 22 Oct 2020 17:15:31 +0200
From: Hendrik Tews <hendrik.tews@HIDDEN>
To: Andreas Schwab <schwab@HIDDEN>
Subject: Re: bug#42013: 26.3; hash tables are not garbage collected
References: <87zh8uwxn3.fsf@HIDDEN> <87k0vi790j.fsf@HIDDEN>
Date: Thu, 22 Oct 2020 17:15:29 +0200
In-Reply-To: <87k0vi790j.fsf@HIDDEN> (Andreas Schwab's message of "Thu, 22
 Oct 2020 14:14:20 +0200")
Message-ID: <87r1pq8f72.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42013
Cc: 42013 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> The garbage collector is conservative, so objects may not be collected
> immediately, even if they appear unreferenced.

OK, would it be possible to update the documentation?

Is there a way to trigger a full collection of all unreachable
objects? I would like to use this and the numbers that
garbage-collect returns to check that a certain piece of code
does not leak memory. Or is there another way to check that all
allocations done within a form are unreachable after leaving that
form?

Thanks

Hendrik




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42013; Package emacs. Full text available.

Message received at 42013 <at> debbugs.gnu.org:


Received: (at 42013) by debbugs.gnu.org; 22 Oct 2020 12:14:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 22 08:14:26 2020
Received: from localhost ([127.0.0.1]:51655 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kVZU9-0001e6-Tz
	for submit <at> debbugs.gnu.org; Thu, 22 Oct 2020 08:14:26 -0400
Received: from mail-out.m-online.net ([212.18.0.10]:34810)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <whitebox@HIDDEN>) id 1kVZU7-0001dx-VC
 for 42013 <at> debbugs.gnu.org; Thu, 22 Oct 2020 08:14:24 -0400
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
 by mail-out.m-online.net (Postfix) with ESMTP id 4CH5rZ1Qdnz1rv05;
 Thu, 22 Oct 2020 14:14:21 +0200 (CEST)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.70])
 by mail.m-online.net (Postfix) with ESMTP id 4CH5rY5lNMz1qwSZ;
 Thu, 22 Oct 2020 14:14:21 +0200 (CEST)
X-Virus-Scanned: amavisd-new at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.182])
 by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new,
 port 10024)
 with ESMTP id EGFVOSVVyFrv; Thu, 22 Oct 2020 14:14:21 +0200 (CEST)
X-Auth-Info: A9Qp1Ht/3k+UaRbACEdwGCvDda5Ljj0j4CnjvvKAzIImHgpHTAhcKoNF2xESgBgM
Received: from igel.home (ppp-46-244-171-124.dynamic.mnet-online.de
 [46.244.171.124])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.mnet-online.de (Postfix) with ESMTPSA;
 Thu, 22 Oct 2020 14:14:21 +0200 (CEST)
Received: by igel.home (Postfix, from userid 1000)
 id B28C72C1C4A; Thu, 22 Oct 2020 14:14:20 +0200 (CEST)
From: Andreas Schwab <schwab@HIDDEN>
To: Hendrik Tews <hendrik.tews@HIDDEN>
Subject: Re: bug#42013: 26.3; hash tables are not garbage collected
References: <87zh8uwxn3.fsf@HIDDEN>
X-Yow: Leona, I want to CONFESS things to you..
 I want to WRAP you in a SCARLET ROBE trimmed with POLYVINYL CHLORIDE..
 I want to EMPTY your ASHTRAYS...
Date: Thu, 22 Oct 2020 14:14:20 +0200
In-Reply-To: <87zh8uwxn3.fsf@HIDDEN> (Hendrik Tews's message of
 "Tue, 23 Jun 2020 00:20:32 +0200")
Message-ID: <87k0vi790j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 42013
Cc: 42013 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.4 (-)

On Jun 23 2020, Hendrik Tews wrote:

> With emacs -Q it returns ((vec2 5) (sym2 1) (vec1 5) (sym1 1)),
> while I was expecting ((vec2 0) (sym2 0) ...).

The garbage collector is conservative, so objects may not be collected
immediately, even if they appear unreferenced.

Andreas.

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42013; Package emacs. Full text available.

Message received at 42013 <at> debbugs.gnu.org:


Received: (at 42013) by debbugs.gnu.org; 22 Oct 2020 11:22:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 22 07:22:42 2020
Received: from localhost ([127.0.0.1]:51556 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kVYg6-0002Oo-LF
	for submit <at> debbugs.gnu.org; Thu, 22 Oct 2020 07:22:42 -0400
Received: from quimby.gnus.org ([95.216.78.240]:41748)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1kVYg5-0002OY-8U
 for 42013 <at> debbugs.gnu.org; Thu, 22 Oct 2020 07:22:41 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=C4QqRHp2Q+fU5xv1M0mBMnVWH+WTgYXV8g3yZgE1IfA=; b=oz/tPZKqMaPv3LcXSBuI61s/i2
 1TBdgJ9IcYDbxgdOdPC9LY/E2OPJDQQbWrtHM8IkVStsjJwZDujWnMV582lP+BxdlltLDqW+7N0Us
 fXAHtEkg1epJ1xgUNmtCrjqvYN74GoQaT8kLdC5jXd+SBoPx2lU2zpvxTo/z+19tLCyg=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1kVYfm-0002G4-DT; Thu, 22 Oct 2020 13:22:34 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Hendrik Tews <hendrik.tews@HIDDEN>
Subject: Re: bug#42013: 26.3; hash tables are not garbage collected
References: <87zh8uwxn3.fsf@HIDDEN> <87a6wlt98n.fsf@HIDDEN>
 <874kmnoidq.fsf@HIDDEN>
X-Now-Playing: Matmos's _Plastic Anniversary_: "The Crying Pill"
Date: Thu, 22 Oct 2020 13:22:21 +0200
In-Reply-To: <874kmnoidq.fsf@HIDDEN> (Hendrik Tews's message of
 "Wed, 21 Oct 2020 14:47:45 +0200")
Message-ID: <87tuumijyq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Hendrik Tews <hendrik.tews@HIDDEN> writes: > It is
 not really clear what you executed to obtain the negative > number. I am
 assuming you executed all the let expressions in > your reply in sequence.
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42013
Cc: 42013 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hendrik Tews <hendrik.tews@HIDDEN> writes:

> It is not really clear what you executed to obtain the negative
> number. I am assuming you executed all the let expressions in
> your reply in sequence.

Yes.  Sometimes it's -1 and sometimes it's 0, apparently.

> To me, the most obvious explanation for the negative number would
> be that garbage-collect does not always perform a full garbage
> collection, therefore the last garbage-collect by chance finally
> performs a full collection and collects one vector that has
> survived the other garbage collections...

Well, or that gc itself allocates some vectors sometimes.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42013; Package emacs. Full text available.

Message received at 42013 <at> debbugs.gnu.org:


Received: (at 42013) by debbugs.gnu.org; 21 Oct 2020 12:47:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 21 08:47:53 2020
Received: from localhost ([127.0.0.1]:48195 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kVDWz-0004QV-DH
	for submit <at> debbugs.gnu.org; Wed, 21 Oct 2020 08:47:53 -0400
Received: from serv1.kernkonzept.com ([159.69.200.6]:37703
 helo=mx.kernkonzept.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <hendrik.tews@HIDDEN>) id 1kVDWy-0004QN-0A
 for 42013 <at> debbugs.gnu.org; Wed, 21 Oct 2020 08:47:52 -0400
Received: from ip5f5a64b2.dynamic.kabel-deutschland.de ([95.90.100.178]
 helo=cert)
 by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) id 1kVDWw-0000iZ-Re; Wed, 21 Oct 2020 14:47:50 +0200
Received: from localhost ([::1] helo=cert)
 by cert with esmtps  (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
 (Exim 4.94) (envelope-from <hendrik.tews@HIDDEN>)
 id 1kVDWw-000A85-EY; Wed, 21 Oct 2020 14:47:49 +0200
From: Hendrik Tews <hendrik.tews@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#42013: 26.3; hash tables are not garbage collected
References: <87zh8uwxn3.fsf@HIDDEN> <87a6wlt98n.fsf@HIDDEN>
Date: Wed, 21 Oct 2020 14:47:45 +0200
In-Reply-To: <87a6wlt98n.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sat,
 17 Oct 2020 12:52:40 +0200")
Message-ID: <874kmnoidq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42013
Cc: 42013 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> => ((vec2 -1) (vec1 4))
>
> Uhmn...

It is not really clear what you executed to obtain the negative
number. I am assuming you executed all the let expressions in
your reply in sequence.

To me, the most obvious explanation for the negative number would
be that garbage-collect does not always perform a full garbage
collection, therefore the last garbage-collect by chance finally
performs a full collection and collects one vector that has
survived the other garbage collections...

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

To me the observed behavior suggests that the Elisp garbage
collector is more complicated than the simple mark and sweep
described in the manual. Can you really confirm, that this is not
the case? Because otherwise I would expect a documentation update
for garbage-collect and in the Garbage Collection appendix.

Hendrik




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42013; Package emacs. Full text available.

Message received at 42013 <at> debbugs.gnu.org:


Received: (at 42013) by debbugs.gnu.org; 17 Oct 2020 10:53:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 17 06:53:01 2020
Received: from localhost ([127.0.0.1]:33551 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kTjpc-00022m-Qz
	for submit <at> debbugs.gnu.org; Sat, 17 Oct 2020 06:53:01 -0400
Received: from quimby.gnus.org ([95.216.78.240]:38854)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1kTjpa-00022W-NR
 for 42013 <at> debbugs.gnu.org; Sat, 17 Oct 2020 06:52:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=llPYVPHFIMA6GQQSbv10kgFWKOz9dkQCFKK/SdZLDBk=; b=g9WeydvIkMaDq42VM89lCbqLf9
 XE2wklFNiywJPT5SYYge+m0P0Y2Wk+GVfvrr+1UxwTiJNCGiVDkHy/+c8339UwIXFx8ujqxHzgR4W
 YJEKH9T8Kt70diaNFJT9rkxQU/BQyp4+YHJHKk5iysxSifZLOhjgDMkNChGjJK1MI3fI=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1kTjpK-0002ma-4D; Sat, 17 Oct 2020 12:52:52 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Hendrik Tews <hendrik.tews@HIDDEN>
Subject: Re: bug#42013: 26.3; hash tables are not garbage collected
References: <87zh8uwxn3.fsf@HIDDEN>
X-Now-Playing: Machinedrum's _Vapor City Citizenship Programme_: "Vapor City
 - Vizion Centre Mix"
Date: Sat, 17 Oct 2020 12:52:40 +0200
In-Reply-To: <87zh8uwxn3.fsf@HIDDEN> (Hendrik Tews's message of
 "Tue, 23 Jun 2020 00:20:32 +0200")
Message-ID: <87a6wlt98n.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Hendrik Tews <hendrik.tews@HIDDEN> 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 'vecto [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42013
Cc: 42013 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hendrik Tews <hendrik.tews@HIDDEN> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42013; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 Jun 2020 23:46:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 22 19:46:40 2020
Received: from localhost ([127.0.0.1]:34925 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jnW97-0006J1-KI
	for submit <at> debbugs.gnu.org; Mon, 22 Jun 2020 19:46:40 -0400
Received: from lists.gnu.org ([209.51.188.17]:52094)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <hendrik.tews@HIDDEN>) id 1jnUo0-0004Cm-47
 for submit <at> debbugs.gnu.org; Mon, 22 Jun 2020 18:20:46 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57132)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <hendrik.tews@HIDDEN>)
 id 1jnUnz-0000Ay-Ur
 for bug-gnu-emacs@HIDDEN; Mon, 22 Jun 2020 18:20:43 -0400
Received: from serv1.kernkonzept.com ([2a01:4f8:1c1c:b490::2]:51975
 helo=mx.kernkonzept.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <hendrik.tews@HIDDEN>)
 id 1jnUnx-0005Lw-OZ
 for bug-gnu-emacs@HIDDEN; Mon, 22 Jun 2020 18:20:43 -0400
Received: from ip5f5a9e4f.dynamic.kabel-deutschland.de ([95.90.158.79]
 helo=cert)
 by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) id 1jnUns-0002c0-Fb
 for bug-gnu-emacs@HIDDEN; Tue, 23 Jun 2020 00:20:36 +0200
Received: from localhost ([::1] helo=cert)
 by cert with esmtps  (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
 (Exim 4.94) (envelope-from <hendrik.tews@HIDDEN>)
 id 1jnUnr-000cEt-BL
 for bug-gnu-emacs@HIDDEN; Tue, 23 Jun 2020 00:20:35 +0200
From: Hendrik Tews <hendrik.tews@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 26.3; hash tables are not garbage collected
Date: Tue, 23 Jun 2020 00:20:32 +0200
Message-ID: <87zh8uwxn3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: softfail client-ip=2a01:4f8:1c1c:b490::2;
 envelope-from=hendrik.tews@HIDDEN; helo=mx.kernkonzept.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -1
X-Spam_score: -0.2
X-Spam_bar: /
X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, KHOP_HELO_FCRDNS=1,
 SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665,
 URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 22 Jun 2020 19:46:36 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi,

I have the impression hash tables and their content are not
garbage collected when the hash table is not referenced any more.
Consider the following piece of elisp code:

    (let (gc-start gc-state hash symbol result)
      ;; record gc statistics
      (setq gc-start (garbage-collect))
      ;; create a hash and put an uninterned symbol into it
      (setq hash (make-hash-table))
      (setq symbol (make-symbol "x"))
      (puthash symbol t hash)
      ;; take gc stats and record the differences of used symbols and used
      ;; vectors in result
      (setq gc-state (garbage-collect))
      (push (list 'sym1 (- (caddr (assoc 'symbols gc-state))
                           (caddr (assoc 'symbols gc-start))))
            result)
      (push (list 'vec1 (- (caddr (assoc 'vectors gc-state))
                           (caddr (assoc 'vectors gc-start))))
            result)
      ;; make the symbol and the hash inaccessible 
      (setq symbol nil)
      (setq hash nil)
      ;; take gc stats again and record the differences of used symbols
      ;; and used vectors in result
      (setq gc-state (garbage-collect))
      (push (list 'sym2 (- (caddr (assoc 'symbols gc-state))
                           (caddr (assoc 'symbols gc-start))))
            result)
      (push (list 'vec2 (- (caddr (assoc 'vectors gc-state))
                           (caddr (assoc 'vectors gc-start))))
            result)
      result)

With emacs -Q it returns ((vec2 5) (sym2 1) (vec1 5) (sym1 1)),
while I was expecting ((vec2 0) (sym2 0) ...).

What am I doing wrong that prevents the third call to
garbage-collect to garbage collect the hash and the uninterned
symbol?

Note that with inserting a clrhash before setting hash to nil,
the symbol gets collected, but the vectors won't. What is needed
to garbage collect a hash table?

Thanks,

Hendrik


text generated by report-emacs-bug:

In GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
 of 2020-05-17, modified by Debian built on x86-csail-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description:	Debian GNU/Linux bullseye/sid

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs-mHAik2/emacs-26.3+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 96516 5845)
 (symbols 48 20785 1)
 (miscs 40 45 96)
 (strings 32 29163 1930)
 (string-bytes 1 763910)
 (vectors 16 14012)
 (vector-slots 8 507754 6556)
 (floats 8 49 68)
 (intervals 56 268 0)
 (buffers 992 12))




Acknowledgement sent to Hendrik Tews <hendrik.tews@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#42013; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 22 Oct 2020 15:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.