diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-05-02 17:12:03 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-05-02 17:12:03 +0000 |
commit | b52e71191094f564d7b7484b89e47e710bb94bdc (patch) | |
tree | aa36002c9e96b31e258e82c903b08a6db03410b0 /src/libexpr/get-drvs.cc | |
parent | 11ae2d1e7af05c3410a368338c7d13a49c2d2ccd (diff) |
* Huge reduction in memory use (2/3 or so on large nix-env -qas
operations): share ATermMaps between DrvInfos.
Diffstat (limited to 'src/libexpr/get-drvs.cc')
-rw-r--r-- | src/libexpr/get-drvs.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index bc2302a0b..78ccab7f3 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -5,7 +5,7 @@ string DrvInfo::queryDrvPath(EvalState & state) const { if (drvPath == "") { - Expr a = attrs.get("drvPath"); + Expr a = attrs->get("drvPath"); (string &) drvPath = a ? evalPath(state, a) : ""; } return drvPath; @@ -15,7 +15,7 @@ string DrvInfo::queryDrvPath(EvalState & state) const string DrvInfo::queryOutPath(EvalState & state) const { if (outPath == "") { - Expr a = attrs.get("outPath"); + Expr a = attrs->get("outPath"); if (!a) throw Error("output path missing"); (string &) outPath = evalPath(state, a); } @@ -27,7 +27,7 @@ MetaInfo DrvInfo::queryMetaInfo(EvalState & state) const { MetaInfo meta; - Expr a = attrs.get("meta"); + Expr a = attrs->get("meta"); if (!a) return meta; /* fine, empty meta information */ ATermMap attrs2; @@ -66,10 +66,10 @@ static bool getDerivation(EvalState & state, Expr e, e = evalExpr(state, e); if (!matchAttrs(e, es)) return true; - ATermMap attrs; - queryAllAttrs(e, attrs, false); + shared_ptr<ATermMap> attrs(new ATermMap()); + queryAllAttrs(e, *attrs, false); - Expr a = attrs.get("type"); + Expr a = attrs->get("type"); if (!a || evalString(state, a) != "derivation") return true; /* Remove spurious duplicates (e.g., an attribute set like @@ -79,11 +79,11 @@ static bool getDerivation(EvalState & state, Expr e, DrvInfo drv; - a = attrs.get("name"); + a = attrs->get("name"); if (!a) throw badTerm("derivation name missing", e); drv.name = evalString(state, a); - a = attrs.get("system"); + a = attrs->get("system"); if (!a) drv.system = "unknown"; else |