From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Tool-bar changes Date: Wed, 14 May 2008 16:50:25 -0400 Message-ID: <87r6c4sj8u.fsf@stupidchicken.com> References: <18457.37369.262079.668907@kahikatea.snap.net.nz> <200805040056.m440u3eS022727@sallyv1.ics.uci.edu> <874p9dn46h.fsf@stupidchicken.com> <87hcd8i7iq.fsf_-_@stupidchicken.com> <87skwmrsax.fsf@stupidchicken.com> <87lk2dsk6x.fsf@stupidchicken.com> <87hcd1h5lj.fsf@stupidchicken.com> <87lk2cisyd.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210798252 29137 80.91.229.12 (14 May 2008 20:50:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 May 2008 20:50:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 14 22:51:26 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JwNwb-0007L3-Up for ged-emacs-devel@m.gmane.org; Wed, 14 May 2008 22:51:26 +0200 Original-Received: from localhost ([127.0.0.1]:56397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JwNvs-00013W-Kr for ged-emacs-devel@m.gmane.org; Wed, 14 May 2008 16:50:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JwNvo-000135-1N for emacs-devel@gnu.org; Wed, 14 May 2008 16:50:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JwNvj-00012C-IQ for emacs-devel@gnu.org; Wed, 14 May 2008 16:50:35 -0400 Original-Received: from [199.232.76.173] (port=42091 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JwNvj-000125-CO for emacs-devel@gnu.org; Wed, 14 May 2008 16:50:31 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]:46498) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JwNvj-0005da-0K for emacs-devel@gnu.org; Wed, 14 May 2008 16:50:31 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id F0A574E4AC; Wed, 14 May 2008 16:50:25 -0400 (EDT) In-Reply-To: <87lk2cisyd.fsf@stupidchicken.com> (Chong Yidong's message of "Wed, 14 May 2008 15:30:50 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:97161 Archived-At: Here's my explanation for the bug: Each time Emacs starts up, main() calls init_fns(), which sets weak_hash_tables to NULL. This means that any weak hash tables that were loaded into memory by temacs are orphaned, and can't be found by sweep_weak_hash_tables. So the solution is to make a new function, init_weak_hash_tables, analogous to init_float etc., and call it from init_alloc_once. The following patch accomplishes this. WDYT? *** trunk/src/alloc.c.~1.439.~ 2008-05-14 12:41:02.000000000 -0400 --- trunk/src/alloc.c 2008-05-14 16:40:48.000000000 -0400 *************** *** 6247,6252 **** --- 6247,6253 ---- init_marker (); init_float (); init_intervals (); + init_weak_hash_tables (); #ifdef REL_ALLOC malloc_hysteresis = 32; *** trunk/src/fns.c.~1.443.~ 2008-05-14 12:41:03.000000000 -0400 --- trunk/src/fns.c 2008-05-14 16:42:02.000000000 -0400 *************** *** 4257,4262 **** --- 4257,4268 ---- Weak Hash Tables ************************************************************************/ + void + init_weak_hash_tables () + { + weak_hash_tables = NULL; + } + /* Sweep weak hash table H. REMOVE_ENTRIES_P non-zero means remove entries from the table that don't survive the current GC. REMOVE_ENTRIES_P zero means mark entries that are in use. Value is *************** *** 5284,5290 **** void init_fns () { - weak_hash_tables = NULL; } /* arch-tag: 787f8219-5b74-46bd-8469-7e1cc475fa31 --- 5290,5295 ----