about summary refs log tree commit diff
path: root/third_party/nix/src
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src')
-rw-r--r--third_party/nix/src/libexpr/eval.cc24
1 files changed, 4 insertions, 20 deletions
diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc
index c6804ee1143d..0abf94c87445 100644
--- a/third_party/nix/src/libexpr/eval.cc
+++ b/third_party/nix/src/libexpr/eval.cc
@@ -5,7 +5,10 @@
 #include <cstring>
 #include <fstream>
 #include <iostream>
+#include <new>
 
+#include <gc/gc.h>
+#include <gc/gc_cpp.h>
 #include <glog/logging.h>
 #include <sys/resource.h>
 #include <sys/time.h>
@@ -21,22 +24,11 @@
 #include "store-api.hh"
 #include "util.hh"
 
-#if HAVE_BOEHMGC
-
-#include <gc/gc.h>
-#include <gc/gc_cpp.h>
-
-#endif
-
 namespace nix {
 
 static char* dupString(const char* s) {
   char* t;
-#if HAVE_BOEHMGC
   t = GC_STRDUP(s);
-#else
-  t = strdup(s);
-#endif
   if (t == nullptr) {
     throw std::bad_alloc();
   }
@@ -617,21 +609,13 @@ inline Value* EvalState::lookupVar(Env* env, const ExprVar& var, bool noEval) {
                              var.pos);
     }
     for (size_t l = env->prevWith; l != 0u; --l, env = env->up) {
-      ;
     }
   }
 }
 
-std::atomic<uint64_t> nrValuesFreed{0};
-
-void finalizeValue(void* obj, void* data) { nrValuesFreed++; }
-
 Value* EvalState::allocValue() {
   nrValues++;
-  auto v = (Value*)allocBytes(sizeof(Value));
-  // GC_register_finalizer_no_order(v, finalizeValue, nullptr, nullptr,
-  // nullptr);
-  return v;
+  return new (GC) Value;
 }
 
 Env& EvalState::allocEnv(size_t size) {