diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-10-09T11·08+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-10-09T11·08+0200 |
commit | 6bb4c0b712788c9cec9a1721ceb3c3a5c89c4181 (patch) | |
tree | 01883ac7eaf1010cc6eefde5c9d1e361b03a03cf /src/libexpr/eval.cc | |
parent | 986fbd6fabdd37077718b1ecfeabae33424ed2c8 (diff) |
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%.
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 5122bd1453f9..5b9db6eeaa6e 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -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; |