From e5c589d271c62f57cd2e7eb7d9841f67d8845ff4 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 13 Aug 2012 15:02:09 -0400 Subject: [PATCH] Don't allocate empty lists This saves about 4 MB when evaluating a NixOS system configuration. --- src/libexpr/eval.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 517a1151ec..cb7c22e291 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -348,7 +348,7 @@ void EvalState::mkList(Value & v, unsigned int length) { v.type = tList; v.list.length = length; - v.list.elems = (Value * *) GC_MALLOC(length * sizeof(Value *)); + v.list.elems = length ? (Value * *) GC_MALLOC(length * sizeof(Value *)) : 0; nrListElems += length; }