Disable refcounting test code when not in use

This commit is contained in:
Brian Carroll 2021-12-30 20:00:25 +00:00
parent c5663e3538
commit 101ac69de2

View file

@ -87,6 +87,8 @@ void *roc_realloc(void *ptr, size_t new_size, size_t old_size,
//-------------------------- //--------------------------
void roc_dealloc(void *ptr, unsigned int alignment) void roc_dealloc(void *ptr, unsigned int alignment)
{
if (rc_pointers)
{ {
// Null out the entry in the test array to indicate that it was freed // Null out the entry in the test array to indicate that it was freed
// Then even if malloc reuses the space, everything still works // Then even if malloc reuses the space, everything still works
@ -102,6 +104,7 @@ void roc_dealloc(void *ptr, unsigned int alignment)
} }
int was_found = i < rc_pointers_index; int was_found = i < rc_pointers_index;
ASSERT(was_found); ASSERT(was_found);
}
#if ENABLE_PRINTF #if ENABLE_PRINTF
printf("roc_dealloc deallocated %p with alignment %zd\n", ptr, alignment); printf("roc_dealloc deallocated %p with alignment %zd\n", ptr, alignment);