From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#54698: non-recursive GC marking [PATCH] Date: Tue, 05 Apr 2022 14:43:15 +0300 Message-ID: <83fsmreox8.fsf@gnu.org> References: <5A577100-75CE-4C9E-A7DA-02B917662AF5@acm.org> <8735itglid.fsf@gnus.org> <8527E407-8190-4574-B8D5-BE68220AE663@acm.org> <871qyc5o0y.fsf@yahoo.com> <5BBEDBDA-4C85-4237-9EF7-5635A4950365@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17563"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, larsi@gnus.org, 54698@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 05 13:44:45 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1nbhc4-0004Sp-U5 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Apr 2022 13:44:44 +0200 Original-Received: from localhost ([::1]:43936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nbhc3-0007zi-Vr for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Apr 2022 07:44:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbhbO-0007qM-Gm for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 07:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59982) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nbhbO-0005wm-6l for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 07:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nbhbO-0001aL-2h for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 07:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Apr 2022 11:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54698 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 54698-submit@debbugs.gnu.org id=B54698.16491590016018 (code B ref 54698); Tue, 05 Apr 2022 11:44:02 +0000 Original-Received: (at 54698) by debbugs.gnu.org; 5 Apr 2022 11:43:21 +0000 Original-Received: from localhost ([127.0.0.1]:53879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nbhai-0001Z0-MG for submit@debbugs.gnu.org; Tue, 05 Apr 2022 07:43:20 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nbhag-0001Yn-NJ for 54698@debbugs.gnu.org; Tue, 05 Apr 2022 07:43:19 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57550) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbhaa-0005YM-HP; Tue, 05 Apr 2022 07:43:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ujBohPcK7F+KzUkpVTc1gWpega0CyfHroKWSMYqIOXI=; b=FqxjjMA8n3oUGEIF75pN 8sUNuONSyjIPEU7aPOIzP792+UE8pRrJ3XY3KCLNHkrDF7G5y8ceEzfAE4BdvVO5p80qVOYzK1QMC yJHTXoBYSvGkToxkd+jk78yncFPYVnoZXQgSXgBriemLVYxuA63/TptyCDEy+6MMOBlXgwV2lAARi xrAYsy3siVTr5O/M8b9i2WyWghYSyIlrIP0QqRYySn7UQWW3WVW3zC6HDLko9agswA5IxuuP4sjzW AUoLhHXMHjK2kPntuP9dSZYDMxsBzwdRMswrinrvZbkhUKoZRtcTmfi2FqhxJSVgIeiwH/nGgONV3 mLKPoJD8TLnYnQ==; Original-Received: from [87.69.77.57] (port=4606 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbhaY-0003ju-B3; Tue, 05 Apr 2022 07:43:11 -0400 In-Reply-To: <5BBEDBDA-4C85-4237-9EF7-5635A4950365@acm.org> (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Tue, 5 Apr 2022 10:08:11 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:229438 Archived-At: > From: Mattias EngdegÄrd > Date: Tue, 5 Apr 2022 10:08:11 +0200 > Cc: Lars Ingebrigtsen , 54698@debbugs.gnu.org > > 5 apr. 2022 kl. 03.15 skrev Po Lu : > > > What happens if it runs out of memory? > > Good question! In theory the answer is simple: abort, as with any other failed xmalloc. Emacs isn't supposed to abort when xmalloc runs out of memory. See memory_full. > In practice, though, malloc probably won't fail at all -- more likely the OS will keep handing out addresses from its 64-bit space and slowly swap itself to death. On Linux, the out-of-memory killer will murder some essential processes at some point. You mean, Emacs fails to know when it approaches the memory limit, and/or react reasonably when memory_full is called? That'd be a bug, IMO. > But it would take a lot of heap for the mark stack requirements to become that big; it's much more likely that you run out of memory allocating your Lisp objects (or something else) first. The memory allocated for the simulated stack during GC is _in_addition_ to what was used for Lisp objects. > > If growing the stack fails, it aborts garbage collection and tells the > > user to type C-x s and exit Emacs. > > Frankly I wouldn't trust saving buffers to be possible when growing the mark stack wasn't. Have you actually tested this? Emacs preserves some memory for that reason. If that doesn't work, we should fix it, IMO. Being able to save your edits when memory is full is an important safety feature in Emacs.