From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: Hash table GC Date: Tue, 15 Oct 2024 15:07:55 +0200 Message-ID: <87zfn5cy50.fsf@gnu.org> References: <86ttdess25.fsf@gnu.org> <86zfn5r1eq.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10692"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.6; emacs 31.0.50 Cc: Anand Tamariya , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 15 15:08:53 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t0hI7-0002OC-GB for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Oct 2024 15:08:47 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0hHS-00008H-Tb; Tue, 15 Oct 2024 09:08:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0hHR-000085-GL for emacs-devel@gnu.org; Tue, 15 Oct 2024 09:08:05 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0hHQ-0008U4-PJ; Tue, 15 Oct 2024 09:08:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=ZwayXxZEN6SfpTX8xp/+O5Ai5160qOVNwD97fPMwtDQ=; b=R4cjCTXdbamd77yI/nPn Oszs1q0RqGffg2gaBUWPe7NhycM5A8H10DMdbjqsBX5uOzMAF+mxsJTdrilfSQ8jRlREmU8Zp669a 5bw9lOWNp9FQKxe297GF8rhW0yS1K8vyLV2BcdL8/aiBm2uq/zgnA7VNHPlVW8YHcsGiEwPrWKsj2 GMapX+KI7eqHAlP2HGs1v21XbzNQFhYR/H3NkZEeSBn01OAeiKJz745px2NnHLybYpeGf8ftvZ6E/ K5jt1rr/1gE7IY9Q+THKYdI6vboTGwncbpzsJdcw5G5chhOVeUSNQSe3SjE9UlqLj6bhoFdJP4TaD 28wRJ9gdsJqOaA==; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdegjedgieduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgesthdtredttdertden ucfhrhhomhepvfgrshhsihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenuc ggtffrrghtthgvrhhnpeeluddvgeefuddvjeekfeetleegtefgveehhfeuffeuffeghefg ueefgfdvffegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhorhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdekieej feekjeekgedqieefhedvleekqdhtshguhheppehgnhhurdhorhhgsehfrghsthhmrghilh drfhhmpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthho pegvmhgrtghsqdguvghvvghlsehgnhhurdhorhhgpdhrtghpthhtoheprghtrghmrghrih ihrgesghhmrghilhdrtghomhdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail In-Reply-To: <86zfn5r1eq.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 15 Oct 2024 15:33:33 +0300") X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324597 Archived-At: Eli Zaretskii writes: >> (dotimes (i 10000) >> (let* ((a (make-hash-table :test 'equal :weakness 'key-or-value)) >> (j 0)) >> (dolist (prop '(padding margin margin-top border >> color background background-color display >> width height clear >> font font-size font-style font-weight)) >> (puthash j (list prop (setq j (1+ j))) a)) >> (pp a) >> )) > > You are using 'key-or-value, which prevents the table from being GCed > of _either_ key or value cannot be GCed. And your keys are symbols, > so they are not GCed. Really? I would assume that in a table with :weakness 'key-or-value the *entries* can be removed/GCed if there are no references to either the entry's key or value. But the whole table should still be GCed if there's no reference to the table itself. So in the above example, I'd think that `a' is GC-able immediately after the `let*`. Running the above many times doesn't seem to increase my Emacs memory footprint so my statement feels right. Bye, Tassilo