diff options
-rw-r--r-- | src/libexpr/eval.cc | 2 | ||||
-rw-r--r-- | src/libexpr/nixexpr.cc | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index eac13c3fd980..fc51590b20cc 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -26,7 +26,7 @@ void EvalState::addPrimOp(const string & name, /* Substitute an argument set into the body of a function. */ static Expr substArgs(Expr body, ATermList formals, Expr arg) { - ATermMap subs; + ATermMap subs(ATgetLength(formals) * 2); Expr undefined = makeUndefined(); /* Get the formal arguments. */ diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 6fb72687d160..aee57acb116e 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -50,9 +50,10 @@ void ATermMap::copy(const ATermMap & map) { ATermList keys = map.keys(); - /* !!! adjust allocation for load pct */ + /* !!! We adjust for the maximum load pct by allocating twice as + much. Probably a bit too much. */ maxLoadPct = map.maxLoadPct; - table = ATtableCreate(ATgetLength(keys), maxLoadPct); + table = ATtableCreate(ATgetLength(keys) * 2, maxLoadPct); if (!table) throw Error("cannot create ATerm table"); add(map, keys); |