mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Disable refcounting test code when not in use
This commit is contained in:
parent
c5663e3538
commit
101ac69de2
1 changed files with 13 additions and 10 deletions
|
@ -88,20 +88,23 @@ 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)
|
||||||
{
|
{
|
||||||
// Null out the entry in the test array to indicate that it was freed
|
if (rc_pointers)
|
||||||
// Then even if malloc reuses the space, everything still works
|
|
||||||
size_t *rc_ptr = alloc_ptr_to_rc_ptr(ptr, alignment);
|
|
||||||
int i = 0;
|
|
||||||
for (; i < rc_pointers_index; ++i)
|
|
||||||
{
|
{
|
||||||
if (rc_pointers[i] == rc_ptr)
|
// Null out the entry in the test array to indicate that it was freed
|
||||||
|
// Then even if malloc reuses the space, everything still works
|
||||||
|
size_t *rc_ptr = alloc_ptr_to_rc_ptr(ptr, alignment);
|
||||||
|
int i = 0;
|
||||||
|
for (; i < rc_pointers_index; ++i)
|
||||||
{
|
{
|
||||||
rc_pointers[i] = NULL;
|
if (rc_pointers[i] == rc_ptr)
|
||||||
break;
|
{
|
||||||
|
rc_pointers[i] = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
int was_found = i < rc_pointers_index;
|
||||||
|
ASSERT(was_found);
|
||||||
}
|
}
|
||||||
int was_found = i < rc_pointers_index;
|
|
||||||
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue