JDK-6539089 : jmap -histo prints negative number as total allocated memory
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 7
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • OS: solaris_10
  • CPU: x86
  • Submitted: 2007-03-27
  • Updated: 2010-11-10
  • Resolved: 2010-11-10
Related Reports
Relates :  
Description
First, can we add a new option to print all (not just alive) objects
with the flag -XX:+PrintClassHistogram?
Currently I have to use jmap to do it.

When I run 32-bits VM with big heap:

% gamma -XX:+PrintClassHistogram -XX:+PrintGCDetails -Xmx2560m -Xmn2200m -Xss96k -XX:+UseParallelOldGC -cp jbb.jar:check.jar spec.jbb.JBBmain

(8 wh)
...
[GC [PSYoungGen: 2204336K->18528K(2221888K)] 2418083K->232275K(2484032K), 0.0577017 secs] [Times: user=0.19 sys=0.01, real=0.06 secs] 

jmap prints negative 'total' value when it prints all allocated objects:

% jdk7_b10/bin/jmap -histo 2343

num   #instances    #bytes  class name
--------------------------------------
  1:  13644309   1207024336  [C
  2:  12320807   295699368  java.lang.String
  3:  10506719   168107504  java.lang.Integer
  4:   4730636   151380352  java.math.BigDecimal
  5:     33085    79933360  [Lspec.jbb.History;
  6:   1035466    66269824  spec.jbb.Orderline
  7:   1431747    34363880  [Ljava.math.BigDecimal;
  8:     33500    30739640  [I
  9:   1795961    28735376  java.lang.StringBuilder
 10:     10989    10319960  [Ljava.lang.Object;
...
556:         1           8  java.lang.reflect.ReflectAccess
557:         1           8  sun.util.resources.LocaleData$LocaleDataResourceBundleControl
Total 48021840   -2126283712