unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Re: GC crashes
Date: Mon, 8 Dec 2003 11:31:24 +0900 (JST)	[thread overview]
Message-ID: <200312080231.LAA12773@etlken.m17n.org> (raw)
In-Reply-To: <jwvllpsh9jh.fsf-monnier+emacs/devel@vor.iro.umontreal.ca> (message from Stefan Monnier on 04 Dec 2003 10:48:21 -0500)

In article <jwvllpsh9jh.fsf-monnier+emacs/devel@vor.iro.umontreal.ca>, Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>>  I've just found one fact about a weak hash table.  Even
>> if composite.c makes a weak hash table in
>> syms_of_composite (thus it is stored in Vweak_hash_tables
>> and dumped), Vweak_hash_tables is intialized to Qnil in
>> init_fns () at Emacs startup time.

> Ha!  That's a bug.

>>  Does it mean that we should not dump a weak hash table?

> No, it just means we have to change init_fns.

Then, it seems that moving this:
  Vweak_hash_tables = Qnil;
to syms_of_fns is the easiest solution.

>>  Do you think it relates to the current problem?

> Sounds likely.  IIUC the above problem means that the mark
> phase of the GC will (correctly) not look at the
> hash-table's elements (because the table is marked as
> weak), but the elements that get GC'd will not be properly
> removed from the table because that is done via
> Vweak_hash_tables.  I.e. the hash table will end up with
> dangling pointers.

Thank you for the explanation.  I think I know understand
the reason of segfault.

>>>  I guess strictly speaking, the :weak arg should not be
>>> t but `key' so that only the key part is weak,
>>  Does it make difference when the value part is always
>> integer?

> No, it shouldn't.  [ Side note: whether an integer should
> be considered as "always live" or as "always GC-able" from
> the point of view of weakness is not obvious. ]

Ah!  I blindly believed that an integer is always GC-able,
but survives_gc_p (obj) returns 1 if obj is an integer.  So
if we make a composition hash table with :weak t, an element
of the table always survives GC, thus is never removed.  It
doesn't fit my intuition but, I'd like to avoid discussing
on it for the momemnt.

I'll try :weak `key' and check if it really works locally.
It seems that we can't commit anything for a while anyway.

---
Ken'ichi HANDA
handa@m17n.org

  reply	other threads:[~2003-12-08  2:31 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-24 10:09 GC crashes Werner LEMBERG
2003-11-26  2:03 ` Kenichi Handa
2003-11-28  9:31   ` [mew-int 01653] " Werner LEMBERG
2003-12-01 12:40     ` [mew-int 01661] " Kenichi Handa
2003-12-02  8:31       ` [mew-int 01666] " Werner LEMBERG
2003-12-02 16:25       ` Stefan Monnier
2003-12-02 23:37         ` [mew-int 01671] " Kenichi Handa
2003-12-03 17:25           ` Stefan Monnier
2003-12-03 23:19             ` Kenichi Handa
2003-12-03 23:58               ` [mew-int 01678] " Stefan Monnier
2003-12-04  0:29               ` Stefan Monnier
2003-12-04  1:12                 ` Kenichi Handa
2003-12-04  2:21                   ` Kenichi Handa
2003-12-04 15:48                     ` Stefan Monnier
2003-12-08  2:31                       ` Kenichi Handa [this message]
2003-12-08  2:52                         ` Stefan Monnier
2003-12-08  5:01                           ` Kenichi Handa
2003-12-08  5:16                             ` Stefan Monnier
2003-12-08  6:05                               ` Kenichi Handa
2003-12-08  6:25                                 ` Stefan Monnier
2003-12-08  7:14                                   ` Kenichi Handa
2003-11-26 14:24 ` Stefan Monnier
2003-12-02  7:01 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2004-12-06 14:32 Items in FOR-RELEASE Stefan
2004-12-06 19:52 ` Juri Linkov
2004-12-06 20:12   ` Stefan Monnier
2004-12-06 21:12     ` Juri Linkov
2004-12-06 21:45       ` Stefan Monnier
2004-12-06 22:47         ` GC crashes (Was: Items in FOR-RELEASE) Juri Linkov
2004-12-07  9:37           ` GC crashes Kim F. Storm
2004-12-07 15:54             ` Paul Pogonyshev
2004-12-07 20:46               ` Jan D.
2004-12-07 20:53               ` Nick Roberts
2004-12-08  0:17                 ` Paul Pogonyshev
2004-12-08  6:04                   ` Jan D.
2004-12-08  7:31                     ` Nick Roberts
2004-12-08 17:39                       ` Eli Zaretskii
2004-12-08 19:27                         ` Nick Roberts
2004-12-08 22:15                 ` Richard Stallman
2005-12-14 21:49 Chong Yidong
2005-12-14 23:18 ` David Kastrup
2005-12-14 23:24   ` Chong Yidong
2005-12-14 23:28     ` David Kastrup
2005-12-17 19:52   ` Chong Yidong
2005-12-18 17:15 ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200312080231.LAA12773@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).