JDK-8023101 : java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java fails
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-08-15
  • Updated: 2014-04-07
  • Resolved: 2013-08-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b106Fixed
Description
----------messages:(3/223)----------
command: main -XX:+UseG1GC -Xmn8m -XX:G1HeapRegionSize=1m ResetPeakMemoryUsage
reason: User specified action: run main/othervm -XX:+UseG1GC -Xmn8m -XX:G1HeapRegionSize=1m ResetPeakMemoryUsage 
elapsed time (seconds): 0.204
----------System.out:(39/1341)----------
Selected memory pool: 
    Memory Pool name: G1 Old Gen
    Type: Heap memory
    Memory Usage: init = 57671680(56320K) used = 0(0K) committed = 57671680(56320K) max = 536870912(524288K)
    Threshold: 0
    Manager = [G1 Old Generation]
Before big object array (of size 9000000) is allocated: 
Current Usage: 
    Initial size   = 57671680 (56320K)
    Used size      = 0
    Committd size  = 57671680 (56320K)
    Max size       = 536870912 (524288K)
Peak Usage: 
    Initial size   = 57671680 (56320K)
    Used size      = 0
    Committd size  = 57671680 (56320K)
    Max size       = 536870912 (524288K)
After the object is allocated: 
Current Usage: 
    Initial size   = 57671680 (56320K)
    Used size      = 34400384 (33594K)
    Committd size  = 57671680 (56320K)
    Max size       = 536870912 (524288K)
Peak Usage: 
    Initial size   = 57671680 (56320K)
    Used size      = 34400384 (33594K)
    Committd size  = 57671680 (56320K)
    Max size       = 536870912 (524288K)
After GC: 
Current Usage: 
    Initial size   = 57671680 (56320K)
    Used size      = 34400384 (33594K)
    Committd size  = 57671680 (56320K)
    Max size       = 536870912 (524288K)
Peak Usage: 
    Initial size   = 57671680 (56320K)
    Used size      = 34400384 (33594K)
    Committd size  = 57671680 (56320K)
    Max size       = 536870912 (524288K)
----------System.err:(14/1000)----------
java.lang.RuntimeException: Before GC: used = 34400384 (33594K)  expected to be > After GC: used = 34400384 (33594K)
	at ResetPeakMemoryUsage.testPool(ResetPeakMemoryUsage.java:121)
	at ResetPeakMemoryUsage.main(ResetPeakMemoryUsage.java:63)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:491)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:724)

Comments
if (usage2.getUsed() >= usage1.getUsed()) { throw new RuntimeException should be if (usage2.getUsed() > usage1.getUsed()) { throw new RuntimeException
15-08-2013