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: Re: frames vs. weak hash tables and garbage collection Date: Fri, 31 Aug 2007 16:15:00 +0100 Message-ID: <86y7fru45n.fsf@macs.hw.ac.uk> References: <86wsvdvmkb.fsf@macs.hw.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1188573312 18956 80.91.229.12 (31 Aug 2007 15:15:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 31 Aug 2007 15:15:12 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Thien-Thi Nguyen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 31 17:15:09 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 1IR8DF-0005HF-JN for geb-bug-gnu-emacs@m.gmane.org; Fri, 31 Aug 2007 17:15:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IR8DE-00067f-OG for geb-bug-gnu-emacs@m.gmane.org; Fri, 31 Aug 2007 11:15:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IR8DC-00067I-W3 for bug-gnu-emacs@gnu.org; Fri, 31 Aug 2007 11:15:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IR8DC-00066r-CH for bug-gnu-emacs@gnu.org; Fri, 31 Aug 2007 11:15:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IR8DC-00066l-8f for bug-gnu-emacs@gnu.org; Fri, 31 Aug 2007 11:15:06 -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 1IR8DB-00063e-To for bug-gnu-emacs@gnu.org; Fri, 31 Aug 2007 11:15:06 -0400 Original-Received: from selene.macs.hw.ac.uk ([137.195.27.40]:41219 helo=127.0.0.1) by izanami.macs.hw.ac.uk with smtp (Exim 4.51) id 1IR8D8-0004MI-VZ; Fri, 31 Aug 2007 16:15:03 +0100 Original-Received: (nullmailer pid 31385 invoked by uid 1001); Fri, 31 Aug 2007 15:15:02 -0000 In-Reply-To: (Thien-Thi Nguyen's message of "Thu\, 30 Aug 2007 05\:00\:48 +0200") 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:16469 Archived-At: Thien-Thi Nguyen writes: > () Joe Wells > () Thu, 30 Aug 2007 02:27:32 +0100 > > ;; 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. > > there's a lot of stuff going on w/ make-frame. > > try replacing `(make-frame)' with: > > (x-create-frame-with-faces) > > here, i see that `reproduce-bug' returns nil. > what do you see? It doesn't help me to even replace make-frame with x-create-frame (the primitive used by x-create-frame-with-faces). Are you able to reproduce the bug at all with the code I originally sent? Thien-Thi Nguyen writes: > another thing: one gc pass may not be enough. > i see (reproduce-bug) => nil only at: > > (dotimes (i N) > (garbage-collect)) > > where (< 1 N). my emacs is tweaked, however (ymmv). Running garbage-collect 10 times makes no difference for me. Here is the code I am now using to reproduce the bug: (defun reproduce-bug () (let ((ht (make-hash-table :weakness 'key))) (let* (after-make-frame-functions (x (x-create-frame nil) ;;(x-create-frame-with-faces) ;;(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. (loop repeat 10 do (garbage-collect)) ;; The hash table should now be empty. (let (l) (maphash (lambda (k v) (push (cons k v) l)) ht) l))) With the above definition, I still get (reproduce-bug) returning ((# . t)) instead of nil. -- Joe