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:
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user