RFR(xxxs) (jdk10): 8168542: os::realloc should return a valid pointer for input size=0

David Holmes david.holmes at oracle.com
Sun Feb 5 02:50:13 UTC 2017

Hi Thomas,

On 4/02/2017 10:09 PM, Thomas Stüfe wrote:
> Hi guys,
> picking up this trivial issue which got pushed to jdk10, could I please
> have a re-review? Oh, also a sponsor.
> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8168542
> webrev:
> http://cr.openjdk.java.net/~stuefe/webrevs/8168542-os_realloc_size_0/jdk10-webrev.01/webrev/
> For reference, the old discussion back in october 16:
> http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2016-October/021675.html

I am still rather confused by both existing code and proposed change - 
the code just seems wrong if passed in a zero size. Passing in zero is a 
bug AFAICS and if buggy code passes in zero then how do we know what it 
will do with the returned value from os::realloc ?


> The webrev is unchanged from the proposal for jdk9, just rebased to
> jdk10/hs.
> @Chris, I decided to not follow your suggestion to move the comparison
> into the #ifndef assert. You are right, this is redundant with the check
> inside os::malloc(), but as you said, checking at the entry of
> os::realloc() makes it clearer.
> Thank you!
> Kind Regards, Thomas

More information about the hotspot-runtime-dev mailing list