Allow setting GC_INITIAL_HEAP_SIZE for hydra-eval-jobs

This cannot be done in the hydra-evaluator systemd unit, since then
every other Nix process (e.g. hydra-evaluator and nix-prefetch-*) will
also allocate the specified heap size, probably leading to OOM.
This commit is contained in:
Eelco Dolstra
2018-05-16 14:14:53 +02:00
parent 691f7e168c
commit 4e27796eba
4 changed files with 64 additions and 49 deletions

View File

@ -13,6 +13,8 @@
#include "globals.hh"
#include "common-eval-args.hh"
#include "hydra-config.hh"
using namespace nix;
@ -157,6 +159,13 @@ int main(int argc, char * * argv)
unsetenv("NIX_PATH");
return handleExceptions(argv[0], [&]() {
auto config = std::make_unique<::Config>();
auto initialHeapSize = config->getStrOption("evaluator_initial_heap_size", "");
if (initialHeapSize != "")
setenv("GC_INITIAL_HEAP_SIZE", initialHeapSize.c_str(), 1);
initNix();
initGC();