RFR(xs): 8168542: os::realloc should return a valid pointer for input size=0
Thomas Stüfe
thomas.stuefe at gmail.com
Mon Oct 24 13:12:13 UTC 2016
Dear all,
please check this tiny bug fix.
Bug report:
https://bugs.openjdk.java.net/browse/JDK-8168542
Webrev:
http://cr.openjdk.java.net/~stuefe/webrevs/8168542-os_realloc_size_0/webrev.00/webrev/
In short, this fixes a corner case for os::realloc() which currently
returns NULL if input size is zero.
But as we have coding which interprets a return value of NULL as OOM (See
ReallocateHeap()), this is not a good solution. It is also inconsistent
with how os::malloc() deals with the same situation and potentially with
the way the native C-Runtime deals with it (currently, in a debug build we
will return NULL in case of size=0 whereas in the release build we just
call the native ::realloc() and return whatever it returns.)
Thank you,
Thomas
More information about the hotspot-runtime-dev
mailing list