10 Replies Latest reply: Jul 16, 2010 7:46 AM by 843798 RSS

    heap size command line, programmatic values, os ps, pmap values

    843798
      Hi,

      I have simple hello program which I am trying to use to find out how os, java reports the heap \ memory usages. I am providing the source and outputs of command. Please comment to analyze the findings. ex. I have set heap sizes to 2M, 5M, 2G etc. and collected output of runtime.getTotalMemory(), ps, pmap. one needs to relate
      1. the total, free memory runtime calls in java report.
      2. pmap reports
      3. ps reports.

      Below are the code and outputs. I am going to post multiple replies due to size limit of this forum messages:
      myhost>cat Hello.java
      public class Hello {
        public static void main(String[] argv) throws Exception {
          Runtime r = Runtime.getRuntime();
          long t = r.totalMemory();
          long f = r.freeMemory();
          System.out.println("total-free=" + t + ":" + f + ";" + (t-f));
          System.out.println("sleeping 50 sec...");
          Thread.sleep(50*1000);//50 sec sleep
          System.out.println("ending");
        }
      }
        • 1. Re: heap size command line, programmatic values, os ps, pmap values
          843798
          default heap setting_
          java -classpath . Hello                                                       
          total-free=439104     //Note: this run was done with println doing just total-free output.                                                  
          sleeping 50 sec...                                                       
                                                            
                                                            
          myhost>jps                                             
          22017 Jps                                                       
          21776 Hello                                                       
                                                            
          myhost>pmap -d 21776; ps -o rss,vsize,size,pid -p 21776;               
          21776: java                                             
          Start Size Perm Offset Device Mapping                                                       
          08048000 40K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/bin/java                    
          08052000 4K rwxp 00009000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/bin/java                                                       
          08053000 132K rwxp 00000000 00:00 [ anon ]                                                       
          ad9ef000 4K ---p 00000000 00:00 [ anon ]                                                  
          ad9f0000 512K rwxp 00001000 00:00 [ anon ]                                                  
          ada70000 12K ---p 00081000 00:00 [ anon ]                                             
          ada73000 312K rwxp 00084000 00:00 [ anon ]                                             
          adac1000 12K ---p 00000000 00:00 [ anon ]                                                  
          adac4000 504K rwxp 00003000 00:00 [ anon ]                                             
          adb42000 12K ---p 00000000 00:00 [ anon ]                                             
          adb45000 504K rwxp 00003000 00:00 [ anon ]                                             
          adbc3000 12K ---p 00081000 00:00 [ anon ]                                             
          adbc6000 312K rwxp 00084000 00:00 [ anon ]                                             
          adc14000 12K ---p 00000000 00:00 [ anon ]                                                  
          adc17000 312K rwxp 00003000 00:00 [ anon ]                                                  
          adc65000 12K ---p 00051000 00:00 [ anon ]                                                  
          adc68000 312K rwxp 00054000 00:00 [ anon ]                                                  
          adcb6000 4K ---p 00000000 00:00 [ anon ]                                                  
          adcb7000 716K rwxp 00001000 00:00 [ anon ]                                                  
          add6a000 1624K r-xs 02fb1000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/rt.jar                                                  
          adf00000 780K rwxp 0001d000 00:00 [ anon ]
          adfc3000 244K ---p 0003e000 00:00 [ anon ]
          ae0e3000 4K ---p 00000000 00:00 [ anon ]
          ae0e4000 512K rwxp 00001000 00:00 [ anon ]
          ae164000 4K ---p 00000000 00:00 [ anon ]
          ae165000 512K rwxp 00001000 00:00 [ anon ]
          ae1e5000 4K ---p 00000000 00:00 [ anon ]
          ae1e6000 512K rwxp 00001000 00:00 [ anon ]
          ae266000 4K ---p 00000000 00:00 [ anon ]
          ae267000 544K rwxp 00001000 00:00 [ anon ]
          ae2ef000 96K rwxp 00008000 00:00 [ anon ]
          ae307000 448K rwxp 00000000 00:00 [ anon ]
          ae377000 1376K rwxp 00070000 00:00 [ anon ]
          ae4cf000 32K rwxp 00000000 00:00 [ anon ]
          ae4d7000 96K rwxp 001d0000 00:00 [ anon ]
          ae4ef000 448K rwxp 00000000 00:00 [ anon ]
          ae55f000 1372K rwxp 00258000 00:00 [ anon ]
          ae6b6000 60K rwxp 00000000 00:00 [ anon ]
          ae6c5000 168K rwxp 001f6000 00:00 [ anon ]
          ae6ef000 16388K rwxp 00000000 00:00 [ anon ]
          af6f0000 49152K rwxp 01221000 00:00 [ anon ]
          b26f0000 228160K rwxp 00000000 00:00 [ anon ]
          c05c0000 703936K rwxp 120f1000 00:00 [ anon ]
          eb530000 28480K rwxp 00000000 00:00 [ anon ]
          ed100000 88000K rwxp 3ec31000 00:00 [ anon ]
          f26f7000 36K rwxp 00000000 00:00 [ anon ]
          f2700000 732K rwxp 00009000 00:00 [ anon ]
          f27b7000 2304K rwxp 00000000 00:00 [ anon ]
          f29f7000 46848K rwxp 00240000 00:00 [ anon ]
          f57b7000 60K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libzip.so
          f57c6000 8K rwxp 0000e000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libzip.so
          f57c8000 32K rwxs 00000000 08:01 /tmp/hsperfdata_mitenm/21776
          f57d0000 548K r-xp 00000000 08:01 /lib/libnss_db.so.2.0.0
          f5859000 4K rwxp 00089000 08:01 /lib/libnss_db.so.2.0.0
          f585a000 72K r-xp 00000000 08:01 /lib/libnsl-2.3.2.so
          f586c000 4K rwxp 00011000 08:01 /lib/libnsl-2.3.2.so
          f586d000 8K rwxp 00000000 00:00 [ anon ]
          f5879000 44K r-xp 00000000 08:01 /lib/libnss_files-2.3.2.so
          f5884000 4K rwxp 0000a000 08:01 /lib/libnss_files-2.3.2.so
          f5885000 140K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libjava.so
          f58a8000 8K rwxp 00023000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libjava.so
          f58aa000 44K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libverify.so
          f58b5000 4K rwxp 0000b000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libverify.so
          f58b6000 12K ---p 00000000 00:00 [ anon ]
          f58b9000 312K rwxp 00003000 00:00 [ anon ]
          f5907000 132K r-xp 00000000 08:01 /lib/tls/libm-2.3.2.so
          f5928000 4K rwxp 00021000 08:01 /lib/tls/libm-2.3.2.so
          f593f000 6960K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/server/libjvm.so
          f600b000 308K rwxp 006cc000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/server/libjvm.so
          f6058000 4240K rwxp 00000000 00:00 [ anon ]
          f647c000 1228K r-xp 00000000 08:01 /lib/tls/libc-2.3.2.so
          f65af000 12K rwxp 00132000 08:01 /lib/tls/libc-2.3.2.so
          f65b2000 12K rwxp 00000000 00:00 [ anon ]
          f65b5000 8K r-xp 00000000 08:01 /lib/libdl-2.3.2.so
          f65b7000 4K rwxp 00001000 08:01 /lib/libdl-2.3.2.so
          f65b8000 28K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/jli/libjli.so
          f65bf000 8K rwxp 00006000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/jli/libjli.so
          f65c1000 52K r-xp 00000000 08:01 /lib/tls/libpthread-0.60.so
          f65ce000 4K rwxp 0000c000 08:01 /lib/tls/libpthread-0.60.so
          f65cf000 8K rwxp 00000000 00:00 [ anon ]
          f65de000 24K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/native_threads/libh
          f65e4000 4K rwxp 00006000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/native_threads/libh
          f65e5000 4K rwxp 00001000 00:00 [ anon ]
          f65e6000 4K r-xp 00000000 00:00 [ anon ]
          f65e7000 4K rwxp 00001000 00:00 [ anon ]
          f65e8000 84K r-xp 00000000 08:01 /lib/ld-2.3.2.so
          f65fd000 4K rwxp 00015000 08:01 /lib/ld-2.3.2.so
          feff8000 32K rwxp ffffa000 00:00 [ stack ]
          mapped: 1191088K writeable/private: 1179612K shared: 1656K
          RSS VSZ SZ PID
          10884 1191088 1179584 21776
          • 2. Re: heap size command line, programmatic values, os ps, pmap values
            843798
            heap=2M_

            myhost>java -classpath . -Xms2M -Xmx2M Hello
            total-free=1966080:1771352;194728
            sleeping 50 sec...
            ending



            myhost>jps
            8261 Jps
            8073 Hello

            myhost>pmap -d 8073; ps -o rss,vsize,size,pid -p 8073
            8073: java
            Start Size Perm Offset Device Mapping
            08048000 40K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/bin/java
            08052000 4K rwxp 00009000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/bin/java
            08053000 916K rwxp 00000000 00:00 [ anon ]
            ed984000 4K ---p 00000000 00:00 [ anon ]
            ed985000 512K rwxp 00001000 00:00 [ anon ]
            eda05000 12K ---p 00081000 00:00 [ anon ]
            eda08000 312K rwxp 00084000 00:00 [ anon ]
            eda56000 12K ---p 00000000 00:00 [ anon ]
            eda59000 504K rwxp 00003000 00:00 [ anon ]
            edad7000 12K ---p 00000000 00:00 [ anon ]
            edada000 504K rwxp 00003000 00:00 [ anon ]
            edb58000 12K ---p 00081000 00:00 [ anon ]
            edb5b000 312K rwxp 00084000 00:00 [ anon ]
            edba9000 12K ---p 00001000 00:00 [ anon ]
            edbac000 312K rwxp 00004000 00:00 [ anon ]
            edbfa000 12K ---p 00052000 00:00 [ anon ]
            edbfd000 312K rwxp 00055000 00:00 [ anon ]
            edc4b000 4K ---p 00000000 00:00 [ anon ]
            edc4c000 716K rwxp 00001000 00:00 [ anon ]
            edcff000 1624K r-xs 02fb1000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/rt.jar
            ede95000 4K ---p 00000000 00:00 [ anon ]
            ede96000 512K rwxp 00001000 00:00 [ anon ]
            edf16000 4K ---p 00000000 00:00 [ anon ]
            edf17000 512K rwxp 00001000 00:00 [ anon ]
            edf97000 4K ---p 00000000 00:00 [ anon ]
            edf98000 512K rwxp 00001000 00:00 [ anon ]
            ee018000 4K ---p 00000000 00:00 [ anon ]
            ee019000 544K rwxp 00001000 00:00 [ anon ]
            ee0a1000 96K rwxp 00008000 00:00 [ anon ]
            ee0b9000 4K rwxp 00000000 00:00 [ anon ]
            ee0ba000 8K rwxp 00001000 00:00 [ anon ]
            ee0bc000 32K rwxp 00000000 00:00 [ anon ]
            ee0c4000 96K rwxp 0000b000 00:00 [ anon ]
            ee0dc000 4K rwxp 00000000 00:00 [ anon ]
            ee0dd000 4K rwxp 00024000 00:00 [ anon ]
            ee0de000 16392K rwxp 00000000 00:00 [ anon ]
            ef0e0000 49152K rwxp 01024000 00:00 [ anon ]
            f20e0000 1024K rwxp 00000000 00:00 [ anon ]
            f21e0000 4096K rwxp 04124000 00:00 [ anon ]
            f25e0000 1024K rwxp 00000000 00:00 [ anon ]
            f26e6000 36K rwxp 00000000 00:00 [ anon ]
            f26ef000 732K rwxp 00009000 00:00 [ anon ]
            f27a6000 2304K rwxp 00000000 00:00 [ anon ]
            f29e6000 46848K rwxp 00240000 00:00 [ anon ]
            f57a6000 32K rwxs 00000000 08:01 /tmp/hsperfdata_mitenm/8073
            f57ae000 548K r-xp 00000000 08:01 /lib/libnss_db.so.2.0.0
            f5837000 4K rwxp 00089000 08:01 /lib/libnss_db.so.2.0.0
            f5838000 44K r-xp 00000000 08:01 /lib/libnss_files-2.3.2.so
            f5843000 4K rwxp 0000a000 08:01 /lib/libnss_files-2.3.2.so
            f5849000 60K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libzip.so
            f5858000 8K rwxp 0000e000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libzip.so
            f585a000 72K r-xp 00000000 08:01 /lib/libnsl-2.3.2.so
            f586c000 4K rwxp 00011000 08:01 /lib/libnsl-2.3.2.so
            f586d000 8K rwxp 00000000 00:00 [ anon ]
            f587c000 24K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/native_threads/libh
            f5882000 4K rwxp 00006000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/native_threads/libh
            f5883000 4K rwxp 00001000 00:00 [ anon ]
            f5884000 4K r-xp 00000000 00:00 [ anon ]
            f5885000 140K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libjava.so
            f58a8000 8K rwxp 00023000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libjava.so
            f58aa000 44K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libverify.so
            f58b5000 4K rwxp 0000b000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libverify.so
            f58b6000 12K ---p 00000000 00:00 [ anon ]
            f58b9000 312K rwxp 00003000 00:00 [ anon ]
            f5907000 132K r-xp 00000000 08:01 /lib/tls/libm-2.3.2.so
            f5928000 4K rwxp 00021000 08:01 /lib/tls/libm-2.3.2.so
            f593f000 6960K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/server/libjvm.so
            f600b000 308K rwxp 006cc000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/server/libjvm.so
            f6058000 4240K rwxp 00000000 00:00 [ anon ]
            f647c000 1228K r-xp 00000000 08:01 /lib/tls/libc-2.3.2.so
            f65af000 12K rwxp 00132000 08:01 /lib/tls/libc-2.3.2.so
            f65b2000 12K rwxp 00000000 00:00 [ anon ]
            f65b5000 8K r-xp 00000000 08:01 /lib/libdl-2.3.2.so
            f65b7000 4K rwxp 00001000 08:01 /lib/libdl-2.3.2.so
            f65b8000 28K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/jli/libjli.so
            f65bf000 8K rwxp 00006000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/jli/libjli.so
            f65c1000 52K r-xp 00000000 08:01 /lib/tls/libpthread-0.60.so
            f65ce000 4K rwxp 0000c000 08:01 /lib/tls/libpthread-0.60.so
            f65cf000 8K rwxp 00000000 00:00 [ anon ]
            f65e7000 4K rwxp 00001000 00:00 [ anon ]
            f65e8000 84K r-xp 00000000 08:01 /lib/ld-2.3.2.so
            f65fd000 4K rwxp 00015000 08:01 /lib/ld-2.3.2.so
            feff6000 40K rwxp ffff8000 00:00 [ stack ]
            mapped: 144576K writeable/private: 133344K shared: 1656K
            RSS VSZ SZ PID
            9948 144576 133072 8073
            • 3. Re: heap size command line, programmatic values, os ps, pmap values
              843798
              heap = 5M_
              myhost>java -classpath . -Xms5M -Xmx5M Hello
              total-free=5111808:4917080;194728
              sleeping 50 sec...


              myhost>pmap -d 30384; ps -o rss,vsize,size,pid -p 30384
              30384: java
              Start Size Perm Offset Device Mapping
              08048000 40K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/bin/java
              08052000 4K rwxp 00009000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/bin/java
              08053000 916K rwxp 00000000 00:00 [ anon ]
              ed984000 4K ---p 00000000 00:00 [ anon ]
              ed985000 512K rwxp 00001000 00:00 [ anon ]
              eda05000 12K ---p 00081000 00:00 [ anon ]
              eda08000 312K rwxp 00084000 00:00 [ anon ]
              eda56000 12K ---p 00000000 00:00 [ anon ]
              eda59000 504K rwxp 00003000 00:00 [ anon ]
              edad7000 12K ---p 00000000 00:00 [ anon ]
              edada000 504K rwxp 00003000 00:00 [ anon ]
              edb58000 12K ---p 00081000 00:00 [ anon ]
              edb5b000 312K rwxp 00084000 00:00 [ anon ]
              edba9000 12K ---p 00000000 00:00 [ anon ]
              edbac000 312K rwxp 00003000 00:00 [ anon ]
              edbfa000 12K ---p 00051000 00:00 [ anon ]
              edbfd000 312K rwxp 00054000 00:00 [ anon ]
              edc4b000 4K ---p 00000000 00:00 [ anon ]
              edc4c000 716K rwxp 00001000 00:00 [ anon ]
              edcff000 1624K r-xs 02fb1000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/rt.jar
              ede95000 4K ---p 00000000 00:00 [ anon ]
              ede96000 512K rwxp 00001000 00:00 [ anon ]
              edf16000 4K ---p 00000000 00:00 [ anon ]
              edf17000 512K rwxp 00001000 00:00 [ anon ]
              edf97000 4K ---p 00000000 00:00 [ anon ]
              edf98000 512K rwxp 00001000 00:00 [ anon ]
              ee018000 4K ---p 00000000 00:00 [ anon ]
              ee019000 544K rwxp 00001000 00:00 [ anon ]
              ee0a1000 96K rwxp 00008000 00:00 [ anon ]
              ee0b9000 8K rwxp 00000000 00:00 [ anon ]
              ee0bb000 4K rwxp 00002000 00:00 [ anon ]
              ee0bc000 32K rwxp 00000000 00:00 [ anon ]
              ee0c4000 96K rwxp 0000b000 00:00 [ anon ]
              ee0dc000 16400K rwxp 00000000 00:00 [ anon ]
              ef0e0000 49152K rwxp 01024000 00:00 [ anon ]
              f20e0000 4096K rwxp 00000000 00:00 [ anon ]
              f24e0000 1024K rwxp 04424000 00:00 [ anon ]
              f25e0000 1024K rwxp 00000000 00:00 [ anon ]
              f26e6000 36K rwxp 00000000 00:00 [ anon ]
              f26ef000 732K rwxp 00009000 00:00 [ anon ]
              f27a6000 2304K rwxp 00000000 00:00 [ anon ]
              f29e6000 46848K rwxp 00240000 00:00 [ anon ]
              f57a6000 32K rwxs 00000000 08:01 /tmp/hsperfdata_mitenm/30384
              f57ae000 548K r-xp 00000000 08:01 /lib/libnss_db.so.2.0.0
              f5837000 4K rwxp 00089000 08:01 /lib/libnss_db.so.2.0.0
              f5838000 44K r-xp 00000000 08:01 /lib/libnss_files-2.3.2.so
              f5843000 4K rwxp 0000a000 08:01 /lib/libnss_files-2.3.2.so
              f5849000 60K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libzip.so
              f5858000 8K rwxp 0000e000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libzip.so
              f585a000 72K r-xp 00000000 08:01 /lib/libnsl-2.3.2.so
              f586c000 4K rwxp 00011000 08:01 /lib/libnsl-2.3.2.so
              f586d000 8K rwxp 00000000 00:00 [ anon ]
              f587c000 24K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/native_threads/libh
              f5882000 4K rwxp 00006000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/native_threads/libh
              f5883000 4K rwxp 00001000 00:00 [ anon ]
              f5884000 4K r-xp 00000000 00:00 [ anon ]
              f5885000 140K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libjava.so
              f58a8000 8K rwxp 00023000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libjava.so
              f58aa000 44K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libverify.so
              f58b5000 4K rwxp 0000b000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libverify.so
              f58b6000 12K ---p 00000000 00:00 [ anon ]
              f58b9000 312K rwxp 00003000 00:00 [ anon ]
              f5907000 132K r-xp 00000000 08:01 /lib/tls/libm-2.3.2.so
              f5928000 4K rwxp 00021000 08:01 /lib/tls/libm-2.3.2.so
              f593f000 6960K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/server/libjvm.so
              f600b000 308K rwxp 006cc000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/server/libjvm.so
              f6058000 4240K rwxp 00000000 00:00 [ anon ]
              f647c000 1228K r-xp 00000000 08:01 /lib/tls/libc-2.3.2.so
              f65af000 12K rwxp 00132000 08:01 /lib/tls/libc-2.3.2.so
              f65b2000 12K rwxp 00000000 00:00 [ anon ]
              f65b5000 8K r-xp 00000000 08:01 /lib/libdl-2.3.2.so
              f65b7000 4K rwxp 00001000 08:01 /lib/libdl-2.3.2.so
              f65b8000 28K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/jli/libjli.so
              f65bf000 8K rwxp 00006000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/jli/libjli.so
              f65c1000 52K r-xp 00000000 08:01 /lib/tls/libpthread-0.60.so
              f65ce000 4K rwxp 0000c000 08:01 /lib/tls/libpthread-0.60.so
              f65cf000 8K rwxp 00000000 00:00 [ anon ]
              f65e7000 4K rwxp 00001000 00:00 [ anon ]
              f65e8000 84K r-xp 00000000 08:01 /lib/ld-2.3.2.so
              f65fd000 4K rwxp 00015000 08:01 /lib/ld-2.3.2.so
              feff7000 36K rwxp ffff9000 00:00 [ stack ]
              mapped: 144572K writeable/private: 133340K shared: 1656K
              RSS VSZ SZ PID
              9956 144572 133068 30384
              • 4. Re: heap size command line, programmatic values, os ps, pmap values
                843798
                heap=2G_
                myhost>java -classpath . -Xms2048M -Xmx2048M Hello
                total-free=2117664768:2114086488;3578280
                sleeping 50 sec...
                ending

                myhost>jps
                25932 Hello
                26251 Jps

                myhost>pmap -d 25932; ps -o rss,vsize,size,pid -p 25932
                25932: java
                Start Size Perm Offset Device Mapping
                08048000 40K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/bin/java
                08052000 4K rwxp 00009000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/bin/java
                08053000 940K rwxp 00000000 00:00 [ anon ]
                6d6cd000 4K ---p 00000000 00:00 [ anon ]
                6d6ce000 512K rwxp 00001000 00:00 [ anon ]
                6d74e000 12K ---p 00000000 00:00 [ anon ]
                6d751000 312K rwxp 00003000 00:00 [ anon ]
                6d79f000 12K ---p 00000000 00:00 [ anon ]
                6d7a2000 504K rwxp 00003000 00:00 [ anon ]
                6d820000 12K ---p 00000000 00:00 [ anon ]
                6d823000 312K rwxp 00003000 00:00 [ anon ]
                6d87f000 12K ---p 00000000 00:00 [ anon ]
                6d882000 636K rwxp 00003000 00:00 [ anon ]
                6d921000 892K ---p 000b0000 00:00 [ anon ]
                6da20000 12K ---p 00000000 00:00 [ anon ]
                6da23000 312K rwxp 00003000 00:00 [ anon ]
                6da71000 12K ---p 00000000 00:00 [ anon ]
                6da74000 312K rwxp 00003000 00:00 [ anon ]
                6dac2000 4K ---p 00000000 00:00 [ anon ]
                6dac3000 716K rwxp 00001000 00:00 [ anon ]
                6db76000 1624K r-xs 02fb1000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/rt.jar
                6dd0c000 4K ---p 00000000 00:00 [ anon ]
                6dd0d000 512K rwxp 00001000 00:00 [ anon ]
                6dd8d000 4K ---p 00000000 00:00 [ anon ]
                6dd8e000 512K rwxp 00001000 00:00 [ anon ]
                6de0e000 4K ---p 00000000 00:00 [ anon ]
                6de0f000 512K rwxp 00001000 00:00 [ anon ]
                6de8f000 4K ---p 00000000 00:00 [ anon ]
                6de90000 544K rwxp 00001000 00:00 [ anon ]
                6df18000 96K rwxp 00008000 00:00 [ anon ]
                6df30000 3676K rwxp 00000000 00:00 [ anon ]
                6e2c7000 96K rwxp 00397000 00:00 [ anon ]
                6e2df000 20484K rwxp 00000000 00:00 [ anon ]
                6f6e0000 49152K rwxp 01421000 00:00 [ anon ]
                726e0000 2097152K rwxp 00000000 00:00 [ anon ]
                f26e6000 36K rwxp 00000000 00:00 [ anon ]
                f26ef000 732K rwxp 00009000 00:00 [ anon ]
                f27a6000 2304K rwxp 00000000 00:00 [ anon ]
                f29e6000 46848K rwxp 00240000 00:00 [ anon ]
                f57a6000 32K rwxs 00000000 08:01 /tmp/hsperfdata_mitenm/25932
                f57ae000 548K r-xp 00000000 08:01 /lib/libnss_db.so.2.0.0
                f5837000 4K rwxp 00089000 08:01 /lib/libnss_db.so.2.0.0
                f5838000 44K r-xp 00000000 08:01 /lib/libnss_files-2.3.2.so
                f5843000 4K rwxp 0000a000 08:01 /lib/libnss_files-2.3.2.so
                f5849000 60K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libzip.so
                f5858000 8K rwxp 0000e000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libzip.so
                f585a000 72K r-xp 00000000 08:01 /lib/libnsl-2.3.2.so
                f586c000 4K rwxp 00011000 08:01 /lib/libnsl-2.3.2.so
                f586d000 8K rwxp 00000000 00:00 [ anon ]
                f587c000 24K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/native_threads/libh
                f5882000 4K rwxp 00006000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/native_threads/libh
                f5883000 4K rwxp 00001000 00:00 [ anon ]
                f5884000 4K r-xp 00000000 00:00 [ anon ]
                f5885000 140K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libjava.so
                f58a8000 8K rwxp 00023000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libjava.so
                f58aa000 44K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libverify.so
                f58b5000 4K rwxp 0000b000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/libverify.so
                f58b6000 12K ---p 00000000 00:00 [ anon ]
                f58b9000 312K rwxp 00003000 00:00 [ anon ]
                f5907000 132K r-xp 00000000 08:01 /lib/tls/libm-2.3.2.so
                f5928000 4K rwxp 00021000 08:01 /lib/tls/libm-2.3.2.so
                f593f000 6960K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/server/libjvm.so
                f600b000 308K rwxp 006cc000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/server/libjvm.so
                f6058000 4240K rwxp 00000000 00:00 [ anon ]
                f647c000 1228K r-xp 00000000 08:01 /lib/tls/libc-2.3.2.so
                f65af000 12K rwxp 00132000 08:01 /lib/tls/libc-2.3.2.so
                f65b2000 12K rwxp 00000000 00:00 [ anon ]
                f65b5000 8K r-xp 00000000 08:01 /lib/libdl-2.3.2.so
                f65b7000 4K rwxp 00001000 08:01 /lib/libdl-2.3.2.so
                f65b8000 28K r-xp 00000000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/jli/libjli.so
                f65bf000 8K rwxp 00006000 00:09 /ms/dist/msjava/PROJ/sunjdk/1.6.0_14/.exec/@sys/jre/lib/i386/jli/libjli.so
                f65c1000 52K r-xp 00000000 08:01 /lib/tls/libpthread-0.60.so
                f65ce000 4K rwxp 0000c000 08:01 /lib/tls/libpthread-0.60.so
                f65cf000 8K rwxp 00000000 00:00 [ anon ]
                f65e7000 4K rwxp 00001000 00:00 [ anon ]
                f65e8000 84K r-xp 00000000 08:01 /lib/ld-2.3.2.so
                f65fd000 4K rwxp 00015000 08:01 /lib/ld-2.3.2.so
                feff6000 40K rwxp ffff8000 00:00 [ stack ]
                mapped: 2244348K writeable/private: 2232224K shared: 1656K
                RSS VSZ SZ PID
                17684 2244348 2232844 25932
                • 5. Re: heap size command line, programmatic values, os ps, pmap values
                  843798
                  mms_ wrote:
                  Please comment to analyze the findings.
                  What? You dump some data here and expect us to post a nicely-analyzed summary of that?

                  No.

                  Why don't you do that?

                  Maybe if you learned [_How To Ask Questions The Smart Way_|http://www.catb.org/~esr/faqs/smart-questions.html], you could get somewhere.
                  • 6. Re: heap size command line, programmatic values, os ps, pmap values
                    843798
                    ++ summarized resend - please see chain from top for details.

                    Hi,

                    I have simple hello program which I am trying to use to find out how os, java reports the heap \ memory usages. I am providing the source and outputs of command. Please comment to analyze the findings. ex. I have set heap sizes to 2M, 5M, 2G etc. and collected output of runtime.getTotalMemory(), ps, pmap. one needs to relate
                    1. the total, free memory runtime calls in java report.
                    2. pmap reports
                    3. ps reports.

                    Below are the code and outputs. I am going to post multiple replies due to size limit of this forum messages:

                    code_
                    myhost>cat Hello.java
                    public class Hello {
                      public static void main(String[] argv) throws Exception {
                        Runtime r = Runtime.getRuntime();
                        long t = r.totalMemory();
                        long f = r.freeMemory();
                        System.out.println("total-free=" + t + ":" + f + ";" + (t-f));
                        System.out.println("sleeping 50 sec...");
                        Thread.sleep(50*1000);//50 sec sleep
                        System.out.println("ending");
                      }
                    }
                    default heap setting
                    java -classpath . Hello
                    total-free=439104 //Note: this run was done with println doing just total-free output.
                    myhost>pmap -d 21776; ps -o rss,vsize,size,pid -p 21776;
                    mapped: 1191088K writeable/private: 1179612K shared: 1656K
                    RSS VSZ SZ PID
                    10884 1191088 1179584 21776

                    heap=2M

                    myhost>java -classpath . -Xms2M -Xmx2M Hello
                    total-free=1966080:1771352;194728
                    myhost>pmap -d 8073; ps -o rss,vsize,size,pid -p 8073
                    mapped: 144576K writeable/private: 133344K shared: 1656K
                    RSS VSZ SZ PID
                    9948 144576 133072 8073

                    heap = 5M
                    myhost>java -classpath . -Xms5M -Xmx5M Hello
                    total-free=5111808:4917080;194728
                    myhost>pmap -d 30384; ps -o rss,vsize,size,pid -p 30384
                    mapped: 144572K writeable/private: 133340K shared: 1656K
                    RSS VSZ SZ PID
                    9956 144572 133068 30384

                    heap=2G
                    myhost>java -classpath . -Xms2048M -Xmx2048M Hello
                    total-free=2117664768:2114086488;3578280
                    myhost>pmap -d 25932; ps -o rss,vsize,size,pid -p 25932
                    mapped: 2244348K writeable/private: 2232224K shared: 1656K
                    RSS VSZ SZ PID
                    17684 2244348 2232844 25932
                    • 7. Re: heap size command line, programmatic values, os ps, pmap values
                      843798
                      mms_ wrote:
                      Please comment to analyze the findings.
                      No, we're not doing your work for you.

                      If you have a specific question, ask it. If you don't, then do your own work at least until you have a specific questio.
                      Below are the code and outputs. I am going to post multiple replies due to size limit of this forum messages:
                      No, don't do that.

                      If the forum tells you that your post is too big, then chances are it's too big for anyone to read. The limit is there for a reason!

                      Especially since you only want us to do your work.
                      • 8. Re: heap size command line, programmatic values, os ps, pmap values
                        843798
                        Hi,

                        My specific question is:
                        I am confused in trying to understand relation between -Xms, -Xmx and how its reported in runtime calls, pmap output, psoutput.

                        Regards,

                        MMS_
                        • 9. Re: heap size command line, programmatic values, os ps, pmap values
                          843798
                          mms_ wrote:
                          My specific question is:
                          I am confused in trying to understand relation between -Xms, -Xmx and how its reported in runtime calls, pmap output, psoutput.
                          That's neither specific nor a question.
                          • 10. Re: heap size command line, programmatic values, os ps, pmap values
                            843798
                            Hi,

                            I have provided with outputs and code. If you look at the summary you can see the numbers but they dont really relate well. I would assume that -Xms, -Xms should show up in runtime calls, ps ouput as VSS, pmap output for mapped but they dont really seem to relate.

                            you know what should be related in these commands regarding memory \ heap ?

                            Regards,

                            MMS_