aboutsummaryrefslogtreecommitdiff
path: root/src/nix/repl.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-06-12 17:26:36 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-06-12 17:49:55 +0200
commit0629601da1d163a059fa19004256961f8ecdeb78 (patch)
treeb69f528da3cfa0a33395216fc4224bb4a27f6af4 /src/nix/repl.cc
parentc905d8b0a84877d3cab10d4a8b8ad81895a6500e (diff)
Move EvalState from the stack to the heap
EvalState contains a few counters (e.g. nrValues) that increase quickly enough that they end up being interpreted as pointers by the garbage collector. Moving it to the heap makes them invisible to the garbage collector. This reduces the max RSS doing 100 evaluations of nixos.tests.firefox.x86_64-linux.drvPath from 455 MiB to 292 MiB. Note: ideally, allocations would be much further up in the 64-bit address space to reduce the odds of an integer being misinterpreted as a pointer. Maybe we can use some linker magic to move the .bss segment to a higher address.
Diffstat (limited to 'src/nix/repl.cc')
-rw-r--r--src/nix/repl.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index f84774a53..4723a1974 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -693,8 +693,8 @@ struct CmdRepl : StoreCommand, MixEvalArgs
void run(ref<Store> store) override
{
- NixRepl repl(searchPath, openStore());
- repl.mainLoop(files);
+ auto repl = std::make_unique<NixRepl>(searchPath, openStore());
+ repl->mainLoop(files);
}
};