ArenaAllocatorReset
Description
Rewind every chunk’s bump cursor and clear the most-recent allocation snapshot, without releasing the chunks themselves. Existing kernel mappings are kept so subsequent allocations can reuse them without going back to mmap.
Parameters
| Name | Direction | Description |
|---|---|---|
self |
in,out | ArenaAllocator instance, or NULL. |
Success
Function returns. Every previously-handed-out pointer is invalid; last_ptr / last_size are cleared so resize-the-most-recent-bump has no rollback target.
Failure
No action when self is NULL.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Arena.c:307:
}
void ArenaAllocatorReset(ArenaAllocator *self) {
if (!self) {
return; bool ok = (a != NULL) && (b != NULL);
ArenaAllocatorReset(&arena);
u8 *c = (u8 *)AllocatorAlloc(alloc_base, 4096, true);
ok = ok && (c != NULL) && (c == a); // Reset reuses the first chunk.
Last updated on