@@ -75,15 +75,19 @@ pub struct MemoryExtra {
7575 pub intptrcast : intptrcast:: MemoryExtra ,
7676
7777 /// Mapping extern static names to their canonical allocation.
78- pub ( crate ) extern_statics : FxHashMap < Symbol , AllocId > ,
78+ extern_statics : FxHashMap < Symbol , AllocId > ,
7979
8080 /// The random number generator used for resolving non-determinism.
8181 /// Needs to be queried by ptr_to_int, hence needs interior mutability.
8282 pub ( crate ) rng : RefCell < StdRng > ,
83+
84+ /// An allocation ID to report when it is being allocated
85+ /// (helps for debugging memory leaks).
86+ tracked_alloc_id : Option < AllocId > ,
8387}
8488
8589impl MemoryExtra {
86- pub fn new ( rng : StdRng , stacked_borrows : bool , tracked_pointer_tag : Option < PtrId > ) -> Self {
90+ pub fn new ( rng : StdRng , stacked_borrows : bool , tracked_pointer_tag : Option < PtrId > , tracked_alloc_id : Option < AllocId > ) -> Self {
8791 let stacked_borrows = if stacked_borrows {
8892 Some ( Rc :: new ( RefCell :: new ( stacked_borrows:: GlobalState :: new ( tracked_pointer_tag) ) ) )
8993 } else {
@@ -94,6 +98,7 @@ impl MemoryExtra {
9498 intptrcast : Default :: default ( ) ,
9599 extern_statics : FxHashMap :: default ( ) ,
96100 rng : RefCell :: new ( rng) ,
101+ tracked_alloc_id,
97102 }
98103 }
99104
0 commit comments