fix(3p/nix/expr): use traceable_allocator for btree_map
The prior use of gc_allocator meant that the btree nodes themselves were being collected. Additionally, have Attr (contains a Value) and Bindings explicitly inherit from gc, even though Bindings is always allocated under `new (GC)`. Detected by running under GC_ENABLE_INCREMENTAL=1. Change-Id: Iacf13b34b5aa12e417ea87c9b46e2bf9199fdb26 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1544 Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
3fdce7c6be
commit
f7a85c5060
1 changed files with 3 additions and 3 deletions
6
third_party/nix/src/libexpr/attr-set.hh
vendored
6
third_party/nix/src/libexpr/attr-set.hh
vendored
|
|
@ -14,7 +14,7 @@ class EvalState;
|
||||||
struct Value;
|
struct Value;
|
||||||
|
|
||||||
/* Map one attribute name to its value. */
|
/* Map one attribute name to its value. */
|
||||||
struct Attr {
|
struct Attr : public gc {
|
||||||
Symbol name;
|
Symbol name;
|
||||||
Value* value; // TODO(tazjin): Who owns this?
|
Value* value; // TODO(tazjin): Who owns this?
|
||||||
Pos* pos; // TODO(tazjin): Who owns this?
|
Pos* pos; // TODO(tazjin): Who owns this?
|
||||||
|
|
@ -26,9 +26,9 @@ struct Attr {
|
||||||
// allocator explicitly specified.
|
// allocator explicitly specified.
|
||||||
using AttributeMap =
|
using AttributeMap =
|
||||||
absl::btree_map<Symbol, Attr, std::less<Symbol>,
|
absl::btree_map<Symbol, Attr, std::less<Symbol>,
|
||||||
gc_allocator<std::pair<const Symbol, Attr>>>;
|
traceable_allocator<std::pair<const Symbol, Attr>>>;
|
||||||
|
|
||||||
class Bindings {
|
class Bindings : public gc {
|
||||||
public:
|
public:
|
||||||
typedef AttributeMap::iterator iterator;
|
typedef AttributeMap::iterator iterator;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue