Fwd: Request for review: 7173044: Memory monitor demo hangs if MemoryUsage obj returns -1 in getMax
David Holmes
david.holmes at oracle.com
Sun Jun 3 20:26:30 PDT 2012
Hi Sean,
This seems reasonable. Perhaps add a couple of comments:
125 private float usedMemMax[]; // used when max pool size is undefined
202 if (totalMemory < 0) { // max is undefined for this pool
David
-----
On 4/06/2012 12:12 PM, Sean Chou wrote:
> Hello,
>
> Would any one like to take one more look ? It will help much !
>
> ---------- Forwarded message ----------
> From: *Sean Chou* <zhouyx at linux.vnet.ibm.com
> <mailto:zhouyx at linux.vnet.ibm.com>>
> Date: Thu, May 31, 2012 at 3:17 PM
> Subject: Request for review: 7173044: Memory monitor demo hangs if
> MemoryUsage obj returns -1 in getMax
> To: serviceability-dev at openjdk.java.net
> <mailto:serviceability-dev at openjdk.java.net>
>
>
> Hi all,
>
> MemoryMonitor demo will hang if MemoryUsage obj returns -1
> in getMax method.
> The demo obtains totalMemory from getMax method, and it is used in
> following loop:
>
> " // .. Memory Free ..
> big.setColor(mfColor);
> int MemUsage = (int) (((totalMemory - usedMemory) / totalMemory) *
> 10);
> int i = 0;
> for ( ; i < MemUsage ; i++) {
> mfRect.setRect(x1+5,(float) y1+ssH+i*blockHeight,
> blockWidth, blockHeight-1);
> big.fill(mfRect);
> }
> "
> If -1 is returned, MemUsage becomes a very large positive value and
> the loop hangs
> the demo.
>
> The bug is not seen in current openjdk because the beans returned
> all has a Max
> value returned. However, -1 is allowed by spec when Max is not set for
> the bean, and
> other jdk might return.
>
> In the patch, max is set to 1m or the max memory usage in history
> for the bean
> if there is no max specified. Please take a look.
>
> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7173044
> Webrev: http://cr.openjdk.java.net/~zhouyx/7173044/webrev.01/ .
>
>
> --
> Best Regards,
> Sean Chou
>
>
>
>
> --
> Best Regards,
> Sean Chou
>
More information about the serviceability-dev
mailing list