#include <bz/memory/arena_internal.h>
#include <bz/memory/allocator.h>
+#include <bz/types/identifier_internal.h>
#include <stdalign.h>
#include <stddef.h>
#include <string.h> // memset... :rolleyes:
BZMemoryArenaID bzMemoryArenaCreate(BZMemoryArenaID hostArena, size_t size, const char *nameFmt, ...) {
bzAssert(size == allocateSize(size));
if (nextUserArena < kMaxUserArenas) {
- return bzMemoryArenaAllocate(&userArenas[++nextUserArena], hostArena, size);
+ BZMemoryArenaID arena = bzMemoryArenaAllocate(&userArenas[++nextUserArena], hostArena, size);
+ bzInsertIdentifier(((char *)arena->identifier), nameFmt);
+ return arena;
} else {
bzError("Too many arenas");
return NULL;
arena->allocationOffsetBottom += fullSize;
}
- bzAssertMessage(ptr != NULL, "Arena is out of memory, failed %s:%d", filename, lineNumber);
+ bzAssertMessage(ptr != NULL, "Arena '%s' is out of memory, failed %s:%d", arena->identifier, filename, lineNumber);
return ptr;
}