From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: Crash when switching to buffer Date: Tue, 02 Jul 2024 06:04:10 +0200 Message-ID: References: <87v81pbgzi.fsf@localhost> <86a5j1fhd1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34903"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , Ihor Radchenko , emacs-devel@gnu.org, eller.helmut@gmail.com To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 02 06:05:36 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sOUls-0008u8-71 for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Jul 2024 06:05:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOUky-0002Gb-21; Tue, 02 Jul 2024 00:04:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOUkw-0002GS-Ix for emacs-devel@gnu.org; Tue, 02 Jul 2024 00:04:38 -0400 Original-Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOUkv-0007MS-06; Tue, 02 Jul 2024 00:04:38 -0400 Original-Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a6fe617966fso332482466b.1; Mon, 01 Jul 2024 21:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719893075; x=1720497875; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5LlfOkarQOqRzVYnYuxavFdBb2Pjn/+O/2XMN9+SVDI=; b=Qls2zKUxjWrXPswIw7SQrqoYSZmkhzJWr5qpkHUkhn563c+QsMhfRLjSaB2unDMXJ2 hRd/aYWzodEn4PInaVwcdTWzKlFjMENbxnAuXemDPsFWnlAk5mQ4xyGILlT4vIm2Xa8k Ey5LuME3Q3SzkHSyHZZjIoWEzgovZsHfDtANHC4kXVmH6o+Bb+u9vSws1Yte8Ep7dDwr 2Cq2YRO+mbt+HSIX7+QcHs23z1GT2WoCZwlh/M7UqMP1ZwuHG42vV/6mecaFgPIU9d3B JE7Fvy7VbSUw+/Fa0zNdm95Hdqxu2KE0vOrPi7kCN/zFKXPHogG7v+g4V21ytt1+RRcn qUhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719893075; x=1720497875; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5LlfOkarQOqRzVYnYuxavFdBb2Pjn/+O/2XMN9+SVDI=; b=Mo74abCXzuj24TS/DbKYZDt0F9AhEErf60Xx6qVAXZhzDDJTgxl5NutdyaP8IcfcZq HhNrUAA2ScdIPAuuEvRNU45YesdK8r95lKSj8WqXsrE4kNMPZME4u59Yu4HwETiuLkSt AgDDOiPNfkTCIp1v0FnvjlZDT/dKM0vK4/S+wXkbnT2AF4VYICRQiH3+HX9eMDrlVq+y +id71EdBzCzkwdmA/EySUyp9TPWusVciQFe68quoC8z/574z+J2ZsPJYFdlH1dlderx7 XlRfZyzBdiTiroBcisvOm0gdTo2lMQLnLCp78LzXaj++Z4CZaaCdVjd88aGMkIx6N9NM 7ZtQ== X-Forwarded-Encrypted: i=1; AJvYcCXuzbGB/aO7vlsAUo88O9I5D9JIRHhYZbWNXc7GPBR5nc/BlYUW2ntGO50JgstvRGqpB0K2D4X8+Mpza3E4jGEG+hK1 X-Gm-Message-State: AOJu0Yyz1ANROiJFJPJcuDkQNKm7WB8v0/ezClBlwvAPndcXpWCj+YQ0 fy92191RRh5UA25agU8TprrnG+oqfWzpdzZjr15zNmJkOLdBSeF1 X-Google-Smtp-Source: AGHT+IGygl8hLj0nolF77Iywixud6xNpgYtCHmEBM3DJLXmmveGpg0/xxBUuxcWb7T3+vNqIVm+Liw== X-Received: by 2002:a17:906:1ece:b0:a72:8c15:c73e with SMTP id a640c23a62f3a-a75144f638dmr434209866b.55.1719893074384; Mon, 01 Jul 2024 21:04:34 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e36129.dip0.t-ipconnect.de. [217.227.97.41]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab0b7f9asm381766366b.219.2024.07.01.21.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 21:04:18 -0700 (PDT) In-Reply-To: (Pip Cet's message of "Tue, 02 Jul 2024 00:22:03 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321090 Archived-At: Pip Cet 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 =F0=9F=91=8D > 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_l= isp_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 =3D=3D lface_id_to_name_size) > +#ifdef HAVE_MPS > + lface_id_to_name =3D > + igc_xpalloc_ambig (lface_id_to_name, &lface_id_to_name_size, 1, MAX_F= ACE_ID, > + sizeof *lface_id_to_name); > +#else > lface_id_to_name =3D > xpalloc (lface_id_to_name, &lface_id_to_name_size, 1, MAX_FACE_ID, > sizeof *lface_id_to_name); > +#endif >=20=20 > Lisp_Object face_id =3D make_fixnum (next_lface_id); > lface_id_to_name[next_lface_id] =3D face; > @@ -7326,7 +7332,11 @@ init_xfaces (void) > { > /* Allocate the lface_id_to_name[] array. */ > lface_id_to_name_size =3D next_lface_id =3D nfaces; > +#ifdef HAVE_MPS > + lface_id_to_name =3D igc_xzalloc_ambig (next_lface_id * sizeof *lface= _id_to_name); > +#else > lface_id_to_name =3D xnmalloc (next_lface_id, sizeof *lface_id_to_nam= e); > +#endif >=20=20 > /* Store the faces. */ > struct Lisp_Hash_Table* table =3D XHASH_TABLE (Vface_new_frame_defaul= ts); 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.