diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-13T19·02-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-13T19·02-0400 |
commit | e5c589d271c62f57cd2e7eb7d9841f67d8845ff4 (patch) | |
tree | 216582f50b4609ea0bd7f6cdc212a15c24e9e1b6 /src/libexpr/eval.cc | |
parent | 3e89ef597ce00dbf82a937aad9efab3c9c7b6dcf (diff) |
Don't allocate empty lists
This saves about 4 MB when evaluating a NixOS system configuration.
Diffstat (limited to '')
-rw-r--r-- | src/libexpr/eval.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 517a1151ec69..cb7c22e2912f 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; } |