bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18410: Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.


From: Paul Eggert
Subject: bug#18410: Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.
Date: Sun, 07 Sep 2014 13:33:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

Eli Zaretskii wrote:
MAX_ALLOCA is a relatively small number compared to the stack space
available on modern systems, so I see no reason to fail and exit in
these cases, it sounds too drastic.

Usually MAX_ALLOCA-related code falls back on malloc, and does not exit merely because a request was larger. callproc.c's child_setup function is special, though, as it executes in a vforked child that cannot safely call malloc because that would screw up the parent's malloc arena. In this special case the child exits (Emacs itself doesn't), so it's not that drastic. It'd be nicer if Emacs would allocate the memory before vforking the child, as that would avoid the limitation, but I daresay it's not urgent to fix this. It should be commented better, though, and I gave that a shot in trunk bzr 117837.

Quite possibly we should increase MAX_ALLOCA on many modern systems. As I recall we last discussed that in July, and Stefan was worried about max-lisp-eval-depth * MAX_ALLOCA * N overflowing the C stack, where N is the maximum nesting depth of SAFE_ALLOCA-using C functions between Lisp functions. Perhaps some of that discussion is moot now, with the stack overflow checking that Dmitry added last month?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]