diff options
| author | Karl Zylinski <karl@zylinski.se> | 2024-12-21 15:47:26 +0100 |
|---|---|---|
| committer | Karl Zylinski <karl@zylinski.se> | 2024-12-21 15:49:48 +0100 |
| commit | e5f32e145512a1fb0db142a214dee2d3b42ac073 (patch) | |
| tree | 58b35cc719a679a11125f9bc47bc248ffd9735ef /core/testing | |
| parent | 314c41ef33a2d11e4313ecca0c708b8d02cd59d7 (diff) | |
Makes tracking allocator default to crashing on a bad free instead of add to bad_free_array. The bad_free_array remains to not break old code. The new default behavior is implemented in a callback that you can override, there's a second provided callback that provides the old behavior where an element was added to bad_free_array. Rationale: Many people are just checking the allocation_map, but don't check the bad free array. Several examples throughout core that use tracking allocator don't check bad_free_array either, so people have been taught not to check it.
Diffstat (limited to 'core/testing')
| -rw-r--r-- | core/testing/runner.odin | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/testing/runner.odin b/core/testing/runner.odin index 6b9d610ed..83a5ac4e7 100644 --- a/core/testing/runner.odin +++ b/core/testing/runner.odin @@ -391,6 +391,7 @@ runner :: proc(internal_tests: []Internal_Test) -> bool { fmt.assertf(alloc_error == nil, "Error allocating memory for task allocator #%i: %v", i, alloc_error) when TRACKING_MEMORY { mem.tracking_allocator_init(&task_memory_trackers[i], mem.rollback_stack_allocator(&task_allocators[i])) + task_memory_trackers[i].bad_free_callback = mem.tracking_allocator_bad_free_callback_add_to_array } } |