Returns an allocator, backed by the current one for its records, that gives every allocation its own pages. The pages end at an inaccessible guard page, so running off the end crashes at once, and a freed block is made read-only, so writing through a stale pointer crashes too. It is slow and uses a page or more per allocation; free it with deinit_unmapping_allocator.
allocator := get_unmapping_allocator();
memory := cast(*u8) allocator.proc(.ALLOCATE, 16, 0, null, allocator.data);
memory[0] = 1;
allocator.proc(.FREE, 0, 16, memory, allocator.data);
deinit_unmapping_allocator(allocator);get_unmapping_allocator :: () -> Allocator
Returns
- Allocator