mirror of
https://github.com/NixOS/nix
synced 2025-06-26 15:51:15 +02:00
mkList: Scrub better
Clearing v.app.right was not enough, because the length field of a list only takes 32 bits, so the most significant 32 bits of v.app.left (a.k.a. v.thunk.env) would remain. This could cause Boehm GC to interpret it as a valid pointer. This change reduces maximum RSS for evaluating the ‘tested’ job in nixos/release-small.nix from 1.33 GiB to 0.80 GiB, and runtime by about 8%.
This commit is contained in:
parent
986fbd6fab
commit
6bb4c0b712
2 changed files with 3 additions and 2 deletions
|
@ -455,6 +455,7 @@ Bindings * EvalState::allocBindings(Bindings::size_t capacity)
|
|||
|
||||
void EvalState::mkList(Value & v, unsigned int length)
|
||||
{
|
||||
clearValue(v);
|
||||
v.type = tList;
|
||||
v.list.length = length;
|
||||
v.list.elems = length ? (Value * *) GC_MALLOC(length * sizeof(Value *)) : 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue