unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Pip Cet <pipcet@protonmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	 Ihor Radchenko <yantar92@posteo.net>,
	emacs-devel@gnu.org,  eller.helmut@gmail.com
Subject: Re: MPS: Crash when switching to buffer
Date: Tue, 02 Jul 2024 06:04:10 +0200	[thread overview]
Message-ID: <m2sewsh22t.fsf@pro2.fritz.box> (raw)
In-Reply-To: <cmbRWfutWovlqG2IR9J5QkzlmGkb1ajJ2y4wlZG75Xn8jQS4MPo86luKQNGFbjthaqj-mjXiiAELGcV4ppjGIvQTBoUGW_HFT4oXfse10aA=@protonmail.com> (Pip Cet's message of "Tue, 02 Jul 2024 00:22:03 +0000")

Pip Cet <pipcet@protonmail.com> writes:

> Thanks, that helps clarify things. So would something like the
> following work? lface_id_to_name is never freed, it seems...

Yes, that works 👍

> Ihor, I'm not sure whether the bug is fully reproducible. If it is, could you please try this?
>
> diff --git a/src/xfaces.c b/src/xfaces.c
> index 2bdd2f660fd..ee26a260ed4 100644
> --- a/src/xfaces.c
> +++ b/src/xfaces.c
> @@ -2970,9 +2970,15 @@ DEFUN ("internal-make-lisp-face", Finternal_make_lisp_face,
>  	 The mapping from Lisp face to Lisp face id is given by the
>  	 property `face' of the Lisp face name.  */
>        if (next_lface_id == lface_id_to_name_size)
> +#ifdef HAVE_MPS
> +	lface_id_to_name =
> +	  igc_xpalloc_ambig (lface_id_to_name, &lface_id_to_name_size, 1, MAX_FACE_ID,
> +			     sizeof *lface_id_to_name);
> +#else
>  	lface_id_to_name =
>  	  xpalloc (lface_id_to_name, &lface_id_to_name_size, 1, MAX_FACE_ID,
>  		   sizeof *lface_id_to_name);
> +#endif
>  
>        Lisp_Object face_id = make_fixnum (next_lface_id);
>        lface_id_to_name[next_lface_id] = face;
> @@ -7326,7 +7332,11 @@ init_xfaces (void)
>  	{
>  	  /* Allocate the lface_id_to_name[] array.  */
>  	  lface_id_to_name_size = next_lface_id = nfaces;
> +#ifdef HAVE_MPS
> +	  lface_id_to_name = igc_xzalloc_ambig (next_lface_id * sizeof *lface_id_to_name);
> +#else
>  	  lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name);
> +#endif
>  
>  	  /* Store the faces.  */
>  	  struct Lisp_Hash_Table* table = XHASH_TABLE (Vface_new_frame_defaults);

Alternatively, we could also use

  Lisp_Object *igc_alloc_lisp_obj_vec (size_t n)

to allocate the vector. That returns an object of type IGC_OBJ_OBJ_VEC
in MPS that eventually gets collected. We would then have to use

  void igc_root_create_exact_ptr (void *var_addr)

for the variable holding the reference to the object, where the
staticpros are done.

Just wanted to mention that this also exists, and has the advantage of
fewer ambiguous references.




  reply	other threads:[~2024-07-02  4:04 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01  9:26 MPS: Crash when switching to buffer Ihor Radchenko
2024-07-01 12:04 ` Eli Zaretskii
2024-07-01 12:13   ` Ihor Radchenko
2024-07-01 12:46     ` Eli Zaretskii
2024-07-01 14:14   ` Pip Cet
2024-07-01 14:42     ` Gerd Möllmann
2024-07-02  0:22       ` Pip Cet
2024-07-02  4:04         ` Gerd Möllmann [this message]
2024-07-02 11:40         ` Ihor Radchenko
2024-07-04 10:31           ` Ihor Radchenko
2024-07-04 11:48             ` Gerd Möllmann
2024-07-04 12:02               ` MPS: User GC customizations (was: MPS: Crash when switching to buffer) Ihor Radchenko
2024-07-04 12:51                 ` MPS: User GC customizations Gerd Möllmann
2024-07-04 13:20                   ` Ihor Radchenko
2024-07-04 14:45                     ` Gerd Möllmann
2024-07-04 15:12                       ` Pip Cet
2024-07-04 16:07                         ` Gerd Möllmann
2024-07-04 16:38                           ` Ihor Radchenko
2024-07-04 17:02                             ` Gerd Möllmann
2024-07-04 17:53                           ` Eli Zaretskii
2024-07-04 18:18                             ` Gerd Möllmann
2024-07-04 18:28                               ` Ihor Radchenko
2024-07-04 18:32                                 ` Pip Cet
2024-07-04 18:43                                   ` Gerd Möllmann
2024-07-04 18:39                               ` Eli Zaretskii
2024-07-04 18:48                                 ` Ihor Radchenko
2024-07-04 13:58                   ` Eli Zaretskii
2024-07-04 14:30                     ` Gerd Möllmann
2024-07-04 15:43                       ` Eli Zaretskii
2024-07-04 15:48                       ` Eli Zaretskii
2024-07-04 15:52                         ` Pip Cet
2024-07-04 16:04                           ` Eli Zaretskii
2024-07-04 17:01                             ` Gerd Möllmann
2024-07-04 18:03                               ` Eli Zaretskii
2024-07-04 18:28                                 ` Gerd Möllmann
2024-07-04 18:43                                   ` Eli Zaretskii
2024-07-04 19:09                                     ` Gerd Möllmann
2024-07-04 19:12                                       ` Eli Zaretskii
2024-07-04 16:38                     ` Pip Cet
2024-07-04 17:06                       ` Gerd Möllmann

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=m2sewsh22t.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=pipcet@protonmail.com \
    --cc=yantar92@posteo.net \
    /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).