realloc behavior

Jason Evans jasone at canonware.com
Tue Feb 28 21:04:35 PST 2012


On 01/29/2012 08:38 AM, Yoni Londner wrote:
> I just started using jemalloc, and one of our tests fail, because
> realloc with size=0
> does malloc with size 1.
>
> from realloc spec at
> http://pubs.opengroup.org/onlinepubs/000095399/functions/realloc.html :
> If/size/is 0 and/ptr/is not a null pointer, the object pointed to is freed.
>
>
> Why does jemalloc chooses to behave differently?

This was a bug.  I committed a fix to the dev branch.  The fix will be 
part of version 3.0.0 (and 2.2.6, if enough bugs surface to warrant it).

Thanks,
Jason



More information about the jemalloc-discuss mailing list