|
|
|
|
|
by flohofwoe
16 days ago
|
|
The DebugAllocator catches use-after-free (at least on page-level), but at the cost of never recycling memory addresses (e.g. it eats through the virtual address space). https://ziglang.org/documentation/master/std/#src/std/heap/d... For higher level code, "generation-counted index handles" might be the better solution to provide temporal runtime memory safety, not part of Zig the stdlib though. Or even better: never use dynamic memory allocation and make all lifetimes 'static' :) |
|
To clarify, is that to say that you have to use the `std.heap.page_allocator` as its backing allocator?