X-Git-Url: https://git.bts.cx/benzene.git/blobdiff_plain/88fe7f92d3fd592960bc2534fcdc534021c870bc..9dd75ef0de4f64d4847b3b50658e322f9b144eea:/src/bz/memory/arena.c diff --git a/src/bz/memory/arena.c b/src/bz/memory/arena.c index 079bb8f..42ffc98 100644 --- a/src/bz/memory/arena.c +++ b/src/bz/memory/arena.c @@ -1,6 +1,7 @@ #include #include +#include #include #include #include // memset... :rolleyes: @@ -28,7 +29,9 @@ static size_t allocateSize(size_t size) { 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; @@ -107,7 +110,7 @@ void *_bzMemoryAlloc(BZMemoryArenaID arena, size_t size, const char *filename, s 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; }