all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dima Kogan <lists@dima.secretsauce.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
Subject: Re: Debugging emacs memory management
Date: Mon, 05 Oct 2015 02:24:07 -0700	[thread overview]
Message-ID: <87d1wt1xe0.fsf@secretsauce.net> (raw)
In-Reply-To: <83r3l9zowx.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Dima Kogan <lists@dima.secretsauce.net>
>> Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
>> Date: Mon, 05 Oct 2015 01:24:08 -0700
>> 
>> > If so, please show the values of the 2 arguments to assoc_no_quit (in
>> > their Lisp form, as displayed by the "pp" command).
>> 
>> This is the crux of the problem. The font_spec is
>> 
>>   #<font-spec nil unknown DejaVu\ Sans\ Mono nil iso10646-1 normal normal normal 14 nil 100 0 ((:name . "monospace-10") (user-spec . "monospace-10"))>
>> 
>> The auto_fontset_alist has many entries, all with the same identical key:
>> 
>>   #<font-spec nil unknown DejaVu\ Sans\ Mono nil iso10646-1 normal normal normal 14 nil 100 0 ((:name) (user-spec . "monospace-10"))>
>
> Not sure if it's relevant, but on my system, neither
> auto_fontset_alist entries nor the value of font_spec have the
> (:name ...) element.  They do have user-spec, but no :name.  Perhaps
> try finding out where does that come from.  (Functions in fontset.el
> look like one possible place.)

OK. So the problem is that fontset_from_font() does

  Lisp_Object font_spec = copy_font_spec (font_object);

and then sets this font_spec as the key to the alist. However
copy_font_spec() is not a deep copy, and the caller to
fontset_from_font() ends up with references to internals of font_spec.
It then changes those internals, and ends up changing the key of the
auto_fontset_alist.

Specifically the (name . ...) cons cell is the one being shared. If
anybody cares, the backtrace of the reset of the :name is

    #0  0x000000000054cdad in XSETCDR (c=15185539, n=0) at lisp.h:1194
    #1  0x0000000000608d42 in font_put_extra (font=19160773, prop=5184, val=0) at font.c:732
    #2  0x000000000060f849 in font_clear_prop (attrs=0x7ffccea52c20, prop=FONT_SLANT_INDEX) at font.c:3044
    #3  0x0000000000509d69 in merge_face_vectors (f=0xf975d0, from=0x7ffccea52d20, to=0x7ffccea52c20, named_merge_points=0x0) at xfaces.c:2130
    #4  0x0000000000510790 in x_supports_face_attributes_p (f=0xf975d0, attrs=0x7ffccea52d20, def_face=0xebb2e0)
        at xfaces.c:4691
    #5  0x00000000005113cb in Fdisplay_supports_face_attributes_p (attributes=10113851, display=16348629)

but this seems hardly relevant. Making copy_font_spec() a deep copy
probably would resolve this. Trying that now.




  reply	other threads:[~2015-10-05  9:24 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11  6:01 Debugging emacs memory management Dima Kogan
2015-02-11 15:05 ` Stefan Monnier
2015-02-15 20:28   ` Dima Kogan
2015-02-15 20:47     ` Eli Zaretskii
2015-02-16  1:39       ` Stefan Monnier
2015-02-17  7:59         ` Dima Kogan
2015-02-17 15:59           ` Eli Zaretskii
2015-02-18  0:07           ` Stefan Monnier
2015-02-11 19:07 ` Florian Weimer
2015-09-15 19:27 ` Dima Kogan
2015-09-16 16:28   ` Paul Eggert
2015-09-20 22:01     ` Dima Kogan
2015-09-21  6:46       ` Eli Zaretskii
2015-09-21  8:54         ` Dima Kogan
2015-09-21 10:00           ` Eli Zaretskii
2015-09-21 10:21             ` Eli Zaretskii
2015-09-22 21:33               ` Dima Kogan
2015-09-23  6:35                 ` Eli Zaretskii
2015-09-23  6:37                   ` Dima Kogan
2015-09-23  7:16                     ` Eli Zaretskii
2015-10-05  7:21               ` Dima Kogan
2015-10-05  7:55                 ` Eli Zaretskii
2015-10-05  8:24                   ` Dima Kogan
2015-10-05  8:33                     ` Eli Zaretskii
2015-10-05  8:43                     ` Eli Zaretskii
2015-10-05  9:24                       ` Dima Kogan [this message]
2015-10-05  9:49                         ` Dima Kogan
2015-10-05  9:58                           ` Andreas Schwab
2015-10-05 10:02                             ` Dima Kogan
2015-10-05 10:47                               ` Eli Zaretskii
2015-10-05 18:19                                 ` Dima Kogan
2015-10-05 18:24                                   ` Eli Zaretskii
2015-10-05 23:21                                   ` Dima Kogan
2015-10-06  2:41                                     ` Eli Zaretskii
2015-10-08 21:51                                       ` Dima Kogan
2015-09-16 16:34   ` Davis Herring
2015-09-16 22:03   ` Markus Triska

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

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

  git send-email \
    --in-reply-to=87d1wt1xe0.fsf@secretsauce.net \
    --to=lists@dima.secretsauce.net \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.