Fix bug with logger, add memory allocation logging
This commit is contained in:
@@ -1,19 +1,28 @@
|
||||
#include "memory.h"
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
|
||||
void *bzAlloc(size_t numBytes) {
|
||||
return malloc(numBytes);
|
||||
void *ptr = malloc(numBytes);
|
||||
bzLoggerOnlyLog(BZ_LOG_TRACE, "Allocating address: %p (num bytes: %llu)", ptr, numBytes);
|
||||
return ptr;
|
||||
}
|
||||
void bzFree(void *ptr) {
|
||||
bzLoggerOnlyLog(BZ_LOG_TRACE, "Freeing address: %p", ptr);
|
||||
free(ptr);
|
||||
}
|
||||
void *bzCalloc(size_t numBytes, size_t count) {
|
||||
return calloc(numBytes, count);
|
||||
void *ptr = calloc(numBytes, count);
|
||||
bzLoggerOnlyLog(BZ_LOG_TRACE, "Allocating address: %p (num bytes: %llu)", ptr, numBytes * count);
|
||||
return ptr;
|
||||
}
|
||||
void *bzResize(void *ptr, size_t newSize) {
|
||||
return realloc(ptr, newSize);
|
||||
void *outPtr = realloc(ptr, newSize);
|
||||
bzLoggerOnlyLog(BZ_LOG_TRACE, "Resizing address: %p (%p) to %llu bytes.", outPtr, ptr, newSize);
|
||||
return outPtr;
|
||||
}
|
||||
|
||||
void *bzMemSet(void *ptr, int value, size_t numBytes) {
|
||||
|
||||
Reference in New Issue
Block a user