mirror of
https://github.com/NixOS/nix
synced 2025-07-07 18:31:49 +02:00
EvalState::callFunction(): Make FunctionCallTrace use less stack space
The FunctionCallTrace object consumes a few hundred bytes of stack
space, even when tracing is disabled. This was causing stack overflows:
$ nix-instantiate '<nixpkgs> -A texlive.combined.scheme-full --dry-run
error: stack overflow (possible infinite recursion)
This is with the default stack size of 8 MiB.
Putting the object on the heap reduces stack usage to < 5 MiB.
(cherry picked from commit 98ef11677c
)
This commit is contained in:
parent
61e816217b
commit
8be0440d44
1 changed files with 3 additions and 4 deletions
|
@ -1096,10 +1096,9 @@ void EvalState::callPrimOp(Value & fun, Value & arg, Value & v, const Pos & pos)
|
||||||
|
|
||||||
void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & pos)
|
void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & pos)
|
||||||
{
|
{
|
||||||
std::optional<FunctionCallTrace> trace;
|
std::unique_ptr<FunctionCallTrace> trace;
|
||||||
if (evalSettings.traceFunctionCalls) {
|
if (evalSettings.traceFunctionCalls)
|
||||||
trace.emplace(pos);
|
trace = std::make_unique<FunctionCallTrace>(pos);
|
||||||
}
|
|
||||||
|
|
||||||
forceValue(fun, pos);
|
forceValue(fun, pos);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue