Don't allocate empty lists

This saves about 4 MB when evaluating a NixOS system configuration.
This commit is contained in:
Eelco Dolstra 2012-08-13 15:02:09 -04:00
parent 3e89ef597c
commit e5c589d271

View file

@ -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;
}