Codereview request: 6980984 java/lang/management/MemoryMXBean/MemoryManagement is not robust when getMax() returns -1

shanliang shanliang.jiang at oracle.com
Wed Jan 22 05:27:41 PST 2014


Hi,

The bug was reproduced only on jdk6 on my Mac, but well passed on 7/8/9.

We can have several solutions, like to use:
    Runtime.getRuntime().maxMemory()
    Runtime.getRuntime().totalMemory;

    MemoryUsage.getCommitted()

or hard-code chunkSize to be 1M.

I found that the test ran much faster with:
    chunkSize = Runtime.getRuntime().freeMemory()/10;
than:
    chunkSize = 1M;

webrev:
http://cr.openjdk.java.net/~sjiang/JDK-6980984/00/

bug:
https://bugs.openjdk.java.net/browse/JDK-6980984

Thanks,
Shanliang


More information about the serviceability-dev mailing list