11
11
12
12
#include " sync/sync.h"
13
13
#include " memory_region.h"
14
- #include " rust_env.h"
15
14
16
15
#if RUSTRT_TRACK_ALLOCATIONS >= 3
17
16
#include < execinfo.h>
@@ -35,15 +34,19 @@ void *memory_region::get_data(alloc_header *ptr) {
35
34
return (void *)((char *)ptr + HEADER_SIZE);
36
35
}
37
36
38
- memory_region::memory_region (rust_env *env, bool synchronized) :
39
- _env(env), _parent(NULL ), _live_allocations(0 ),
40
- _detailed_leaks(env->detailed_leaks),
37
+ memory_region::memory_region (bool synchronized,
38
+ bool detailed_leaks,
39
+ bool poison_on_free) :
40
+ _parent(NULL ), _live_allocations(0 ),
41
+ _detailed_leaks(detailed_leaks),
42
+ _poison_on_free(poison_on_free),
41
43
_synchronized(synchronized) {
42
44
}
43
45
44
46
memory_region::memory_region (memory_region *parent) :
45
- _env(parent->_env), _parent(parent), _live_allocations(0 ),
47
+ _parent(parent), _live_allocations(0 ),
46
48
_detailed_leaks(parent->_detailed_leaks),
49
+ _poison_on_free(parent->_poison_on_free),
47
50
_synchronized(parent->_synchronized) {
48
51
}
49
52
@@ -241,7 +244,7 @@ memory_region::claim_alloc(void *mem) {
241
244
void
242
245
memory_region::maybe_poison (void *mem) {
243
246
244
- if (!_env-> poison_on_free )
247
+ if (!_poison_on_free )
245
248
return ;
246
249
247
250
# if RUSTRT_TRACK_ALLOCATIONS >= 1
0 commit comments