GNU bug report logs - #79737
Consider increasing MAX_ALLOCA

Previous Next

Package: emacs;

Reported by: Przemysław Alexander Kamiński <alexander <at> kaminski.se>

Date: Fri, 31 Oct 2025 08:59:02 UTC

Severity: normal

To reply to this bug, email your comments to 79737 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79737; Package emacs. (Fri, 31 Oct 2025 08:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Przemysław Alexander Kamiński <alexander <at> kaminski.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 31 Oct 2025 08:59:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Przemysław Alexander Kamiński
 <alexander <at> kaminski.se>
To: bug-gnu-emacs <at> gnu.org 
Subject: Consider increasing MAX_ALLOCA
Date: Fri, 31 Oct 2025 09:57:48 +0100
Summary:

Request to consider updating MAX_ALLOCA value in order to decrease heap
allocation (anecdotal performance boost on macOS observed).

Context:

Some critical functions (e.g. process reads, overlays, regex etc.) are
using SAFE_ALLOCA. SAFE_ALLOCA is allocating up to available
MAX_ALLOCA and defers to record_xmalloc if either:

- Requested allocation is bigger than MAX_ALLOCA
- Available pool was exhausted

This results in (usually) small, subsequent heap allocations.

MAX_ALLOCA has two functions:
- Is used as a stack allocation size
- Is used as an object allocation size

It seems rare for function to have more than single SAFE_ALLOCA and
over 21 years (when MAX_ALLOCA was introduced) default parameters for
operating systems had changed over time and could be used to decrease
allocation pressure.

I have a patch that I use for macOS that decreased temporary
heap allocation considerably (from 1:10 to 1:2, persistent to
temporary allocations).

-- 
Przemysław Alexander Kamiński (vel xlii vel exlee)
https://xlii.space  ||  https://codeberg.org/exlee




This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.