Tests: Prevent array reallocations during ts_stack_print_dot_graph
When debugging a test with 'script/test -D', the DOT-graph generation code was sometimes causing reallocations that were not captured by the allocation tracker, because we explicitly disable allocation-tracking for that method in order to reduce noise when debugging memory leaks. By growing the relevant array *prior* to turning off allocation tracking, we can ensure that it is not reallocated within that function, avoiding false positive memory leak errors. Fixes #302
This commit is contained in:
parent
1e585d506f
commit
006a931ab8
3 changed files with 7 additions and 9 deletions
|
|
@ -98,7 +98,9 @@ extern "C" fn ts_record_free(ptr: *mut c_void) {
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn ts_record_allocations_toggle() {
|
||||
extern "C" fn ts_toggle_allocation_recording(enabled: bool) -> bool {
|
||||
let mut recorder = RECORDER.lock();
|
||||
recorder.enabled = !recorder.enabled;
|
||||
let was_enabled = recorder.enabled;
|
||||
recorder.enabled = enabled;
|
||||
was_enabled
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue