RFR(S): 8058897 - Unsafe.reallocateMemory() ignores -XX:MallocMaxTestWords setting.
Christian Tornqvist
christian.tornqvist at oracle.com
Wed Jan 7 16:28:03 UTC 2015
Hi David,
>58 try {
>59 unsafe.reallocateMemory(address, 20 * 1000 * 1000 * 8);
>60 throw new RuntimeException("Did not get expected OOM");
>
>You might get OOM from the "throw new ..." rather than the reallocate. :)
Good catch, fixed this by returning inside the catch and moved the "throw
new..." outside of the try {} block
Updated can be found at:
http://cr.openjdk.java.net/~ctornqvi/webrev/8058897/webrev.01/
Thanks,
Christian
-----Original Message-----
From: David Holmes [mailto:david.holmes at oracle.com]
Sent: Tuesday, January 6, 2015 8:46 PM
To: Christian Tornqvist; 'hotspot-runtime-dev'
Subject: Re: RFR(S): 8058897 - Unsafe.reallocateMemory() ignores
-XX:MallocMaxTestWords setting.
Hi Christian,
On 7/01/2015 10:12 AM, Christian Tornqvist wrote:
> Hi everyone,
>
> This change makes realloc use MallocMaxTestWords, a debug option used
> to simulate malloc OOM.
diagnostic not debug. :)
> Webrev:
>
> http://cr.openjdk.java.net/~ctornqvi/webrev/8058897/webrev.00/
As this is diagnostic this may not matter much but you now update the
counter before doing the actual malloc/realloc. I don't know how this gets
used in practice so don't know if it might impact anything.
Nit - the test may have a bug:
58 try {
59 unsafe.reallocateMemory(address, 20 * 1000 * 1000 * 8);
60 throw new RuntimeException("Did not get expected OOM");
You might get OOM from the "throw new ..." rather than the reallocate. :)
But for what this is this seems fine. :)
David
>
>
> Bug:
>
> https://bugs.openjdk.java.net/browse/JDK-8058897
>
>
>
> Thanks,
>
> Christian
>
More information about the hotspot-runtime-dev
mailing list