RFR(S): 8058897 - Unsafe.reallocateMemory() ignores -XX:MallocMaxTestWords setting.

Daniel D. Daugherty daniel.daugherty at oracle.com
Wed Jan 7 14:47:26 UTC 2015


On 1/6/15 5:12 PM, Christian Tornqvist wrote:
> Hi everyone,
>
>   
>
> This change makes realloc use MallocMaxTestWords, a debug option used to
> simulate malloc OOM.
>
>   
>
> Webrev:
>
> http://cr.openjdk.java.net/~ctornqvi/webrev/8058897/webrev.00/

src/share/vm/runtime/os.cpp
     The old testMalloc() function would increment cur_malloc_words only
     if the underlying ::malloc() call succeeded. This was intentional.
     The switch to has_reached_max_malloc_test_peak() followed by the
     ::malloc() call means that an intentionally large failing ::malloc()
     call will result in falsely reaching the test peak.


test/runtime/Unsafe/Reallocate.java
     Should this test have an @bug entry?

     line 59: unsafe.reallocateMemory(address, 20 * 1000 * 1000 * 8);
         Shouldn't this be "1024 * 1024" instead of "1000 * 1000"?

         Also, -XX:MallocMaxTestWords=20m means 20m words and not
         20m bytes so the "* 8" part might not always cause an OOM.

Dan


>
>   
>
> Bug:
>
> https://bugs.openjdk.java.net/browse/JDK-8058897
>
>   
>
> Thanks,
>
> Christian
>



More information about the hotspot-runtime-dev mailing list