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

2014-01-23 Thread shanliang
Jaroslav Bachorik wrote: Looks good. Just a side question - why are you using the divider of 10 (and the original divider is 20)? Did change to 20 in the last version :) I tested with different dividers and got almost same running time with 10 and 20. Thanks, Shanliang -JB- On 22.1.2014

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

2014-01-23 Thread Jaroslav Bachorik
Looks good. Just a side question - why are you using the divider of 10 (and the original divider is 20)? -JB- On 22.1.2014 17:29, shanliang wrote: Here is the new version: http://cr.openjdk.java.net/~sjiang/JDK-6980984/01/ with the modifications for: 1) synchronization issues raised by

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

2014-01-22 Thread Daniel Fuchs
Hi Shanliang, This looks reasonable to me. I'm not sure that using freeMemory() will always work - but at the worst it means that there are still some cases where the test that used to fail will continue to fail ;-) We have both seen that it fixes the original issue which was encountered on Mac

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

2014-01-22 Thread shanliang
Here is the new version: http://cr.openjdk.java.net/~sjiang/JDK-6980984/01/ with the modifications for: 1) synchronization issues raised by Daniel 2) "setUsatgeThreshold" -> "setUsageThreshold" The odd issue about getting slower with: chunkSize = 1M; maybe was from the "old gen" behavior,

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

2014-01-22 Thread Daniel Fuchs
Hi Shanliang, I just notice that there are some synchronization issues in the test as well: all static variables used by the allocator thread should be declared volatile (chunkSize, mpool ...). -- daniel On 1/22/14 2:27 PM, shanliang wrote: Hi, The bug was reproduced only on jdk6 on my Mac, b

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

2014-01-22 Thread Daniel Fuchs
On 1/22/14 3:32 PM, shanliang wrote: Jaroslav Bachorik wrote: Hi Shanliang, On 22.1.2014 14:27, shanliang wrote: 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

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

2014-01-22 Thread shanliang
Jaroslav Bachorik wrote: On 22.1.2014 15:32, shanliang wrote: Jaroslav Bachorik wrote: Hi Shanliang, On 22.1.2014 14:27, shanliang wrote: 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().maxMem

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

2014-01-22 Thread Jaroslav Bachorik
On 22.1.2014 15:32, shanliang wrote: Jaroslav Bachorik wrote: Hi Shanliang, On 22.1.2014 14:27, shanliang wrote: 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

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

2014-01-22 Thread shanliang
Jaroslav Bachorik wrote: Hi Shanliang, On 22.1.2014 14:27, shanliang wrote: 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.getCo

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

2014-01-22 Thread Jaroslav Bachorik
Hi Shanliang, On 22.1.2014 14:27, shanliang wrote: 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() You were also

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

2014-01-22 Thread shanliang
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 faste