[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Request for review: 7173044: Memory monitor demo hangs if MemoryUsage obj returns -1 in getMax
From:       erik.gahlin () oracle ! com (Erik Gahlin)
Date:       2012-05-31 21:20:07
Message-ID: 4FC7E087.1010901 () oracle ! com
[Download RAW message or body]

Hi,

I'm not an offical reviewer, but why do you initialize the array to 
1024K and not 1?

Do you get problems with lower values?

Best regards
Erik

Sean Chou skrev 2012-05-31 09:17:
> 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/ 
> <http://cr.openjdk.java.net/%7Ezhouyx/7173044/webrev.01/>  .
>
>
> -- 
> Best Regards,
> Sean Chou
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic