From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Help please! To track down GC trying to free an already freed object. Date: Thu, 4 Apr 2019 18:57:55 +0000 Message-ID: <20190404185755.GB6417@ACM> References: <20190402112537.GA6212@ACM> <83r2akfnyh.fsf@gnu.org> <20190402204237.GB25792@ACM> <83zhp7em1h.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="260125"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 04 20:58:25 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hC7ZA-0015XB-74 for ged-emacs-devel@m.gmane.org; Thu, 04 Apr 2019 20:58:24 +0200 Original-Received: from localhost ([127.0.0.1]:58702 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hC7Z9-0006GW-7z for ged-emacs-devel@m.gmane.org; Thu, 04 Apr 2019 14:58:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hC7Z0-0006F2-0l for emacs-devel@gnu.org; Thu, 04 Apr 2019 14:58:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hC7Yx-0002ui-S2 for emacs-devel@gnu.org; Thu, 04 Apr 2019 14:58:13 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:31315 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1hC7Ys-0002WH-55 for emacs-devel@gnu.org; Thu, 04 Apr 2019 14:58:07 -0400 Original-Received: (qmail 78408 invoked by uid 3782); 4 Apr 2019 18:57:58 -0000 Original-Received: from acm.muc.de (p4FE15EA7.dip0.t-ipconnect.de [79.225.94.167]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 04 Apr 2019 20:57:57 +0200 Original-Received: (qmail 629 invoked by uid 1000); 4 Apr 2019 18:57:55 -0000 Content-Disposition: inline In-Reply-To: <83zhp7em1h.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234959 Archived-At: Hello, Eli. On Wed, Apr 03, 2019 at 07:43:22 +0300, Eli Zaretskii wrote: > > Date: Tue, 2 Apr 2019 20:42:37 +0000 > > From: Alan Mackenzie > > Cc: emacs-devel@gnu.org > > I'm having some difficult seeing the entire last_marked array with GDB. > > I will try to find a solution in the GDB manual. > You want "set print elements unlimited", I think. > However, my recommendation is to examine the array one element at a > time, moving back to the previous one only when you understand what > the element you've looked at is and whether it is or isn't related to > the problem. Also, last_marked array is written cyclically, so you > may need to wrap around the index to see the objects in the right > order. I've found the bug. In the garbage collection, it's necessary for Qsymbols_with_pos_enabled to be bound to nil. (That's the variable which enables symbols with position). I had bound that variable to nil in Fgarbage_collect, not noticing that there are calls to the C function garbage_collect which bypass the primitive. This was the bug. As a result, the pseudovector (Symbol "nil" at position 339) was caught by a NILP, causing it not to get marked. So it got swept away, even though it was still live. So I've spent several days on this, but as a consolation I now know GDB much better than I did before. ;-). My branch now builds successfully. Thanks for all the help! -- Alan Mackenzie (Nuremberg, Germany).