From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Wells Newsgroups: gmane.emacs.bugs Subject: frames vs. weak hash tables and garbage collection Date: Thu, 30 Aug 2007 02:27:32 +0100 Message-ID: <86wsvdvmkb.fsf@macs.hw.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1188437270 3936 80.91.229.12 (30 Aug 2007 01:27:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 30 Aug 2007 01:27:50 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 30 03:27:49 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IQYov-0007HT-JO for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Aug 2007 03:27:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IQYou-0004cs-Vk for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Aug 2007 21:27:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IQYor-0004Xd-SZ for bug-gnu-emacs@gnu.org; Wed, 29 Aug 2007 21:27:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IQYoq-0004Un-F7 for bug-gnu-emacs@gnu.org; Wed, 29 Aug 2007 21:27:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IQYoq-0004UT-8e for bug-gnu-emacs@gnu.org; Wed, 29 Aug 2007 21:27:36 -0400 Original-Received: from izanami.macs.hw.ac.uk ([137.195.13.6]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IQYop-0002se-N6 for bug-gnu-emacs@gnu.org; Wed, 29 Aug 2007 21:27:36 -0400 Original-Received: from lxultra1.macs.hw.ac.uk ([137.195.27.173]:53747 helo=127.0.0.1) by izanami.macs.hw.ac.uk with smtp (Exim 4.51) id 1IQYom-0005La-TA for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2007 02:27:32 +0100 Original-Received: (nullmailer pid 31233 invoked by uid 1001); Thu, 30 Aug 2007 01:27:32 -0000 User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16461 Archived-At: In a fresh =E2=80=9Cemacs -Q=E2=80=9D, define this function: (defun reproduce-bug () (let ((ht (make-hash-table :weakness 'key))) (let ((x (make-frame) ;;(get-buffer-create "xyzzy") )) (puthash x t ht) (delete-frame x) ;;(kill-buffer x) ) ;; The only reference to the new frame is now the key in the hash ;; table. Because of the weakness, this key should not keep the ;; frame alive. (garbage-collect) ;; The hash table should now be empty. (let (l) (maphash (lambda (k v) (push (cons k v) l)) ht) l))) Then evaluating (reproduce-bug) will produce a result like this: ((# . t)) It should instead return nil. If I replace the calls to make-frame and delete-frame by calls to get-buffer-create and kill-buffer (see commented out lines above), things work properly. So this verifies that weak hash tables work at least for some data types. There are two possibilities that occur to me: 1. Maybe frames are simply not being garbage collected at all. 2. Maybe the feature of weak keys in hash tables doesn't work for the particular case of frames. I hope this bug report is helpful. Joe =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20) of 2007-06-27 on artemis Windowing system distributor `The X.Org Foundation', version 11.0.70000000 configured using `configure '--prefix=3D/home/jbw/local2' '--enable-debug'= '--disable-nls' '--with-x-toolkit=3Dgtk' 'CFLAGS=3D-O0 -g3 -ggdb'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: en_US.UTF-8 value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: jbw value of $LANG: nil locale-coding-system: utf-8 default-enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t