uint64_t origAllocated = *counter;
- const void* ptr = malloc(1);
+ static const void* volatile ptr = malloc(1);
if (!ptr) {
// wtf, failing to allocate 1 byte
return false;
}
- /* Avoid optimizing away the malloc. */
- asm volatile("" ::"m"(ptr) : "memory");
-
return (origAllocated != *counter);
}();