aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/common-opts.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-10-22 14:47:42 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-10-22 14:47:42 +0000
commit41c45a9b319a5578e2731505ca3de2b9c50b4988 (patch)
tree8bc5da0b8bcb62393a7f143611d6627b03589400 /src/libexpr/common-opts.cc
parent64c3325b0bef8c0234bf797033e129323b36ad1e (diff)
* Store Value nodes outside of attribute sets. I.e., Attr now stores
a pointer to a Value, rather than the Value directly. This improves the effectiveness of garbage collection a lot: if the Value is stored inside the set directly, then any live pointer to the Value causes all other attributes in the set to be live as well.
Diffstat (limited to 'src/libexpr/common-opts.cc')
-rw-r--r--src/libexpr/common-opts.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libexpr/common-opts.cc b/src/libexpr/common-opts.cc
index 9131951e3..6b393c07d 100644
--- a/src/libexpr/common-opts.cc
+++ b/src/libexpr/common-opts.cc
@@ -20,12 +20,13 @@ bool parseOptionArg(const string & arg, Strings::iterator & i,
if (i == argsEnd) throw error;
string value = *i++;
- Value & v(autoArgs[state.symbols.create(name)].value);
+ Value * v = state.allocValue();
+ autoArgs[state.symbols.create(name)].value = v;
if (arg == "--arg")
- state.mkThunk_(v, parseExprFromString(state, value, absPath(".")));
+ state.mkThunk_(*v, parseExprFromString(state, value, absPath(".")));
else
- mkString(v, value);
+ mkString(*v, value);
return true;
}