On 18/10/2025 17:39, Tobias Burnus wrote:
OK, I will review realloc in both patches.
Thanks. (I admittedly forgot to recheck when looking at your "PATCH v6
2/2".)
The OS-specific code does not need to handle the case where size==0 in
realloc because the top-level code has already checked it:
void *
omp_realloc (void *ptr, size_t size, omp_allocator_handle_t allocator,
omp_allocator_handle_t free_allocator)
{
[...snip variables and null ptr check...]
if (__builtin_expect (size == 0, 0))
{
ialias_call (omp_free) (ptr, free_allocator);
return NULL;
}
IOW, omp_realloc with size 0 is just the same as a call to omp_free, and
all other cases are ignored.
There's nothing left for linux_memspace_realloc to handle.
Andrew