jmap命令(Java Memory Map)的使用

來源:互聯網
上載者:User

標籤:mst   相關   art   null   pre   jvm   tail   get   bing   

jmap的使用能夠參考:

官方文檔 http://docs.oracle.com/javase/6/docs/technotes/tools/share/jmap.html

和這篇部落格 http://blog.csdn.net/fenglibing/article/details/6411953

本文主要是介紹一下jmap經常使用的幾個參數,作為自己的備忘錄。注意假設是使用64位的JVM,使用jmap的時候,須要加-J-d64


1、列印每一個class的執行個體數量,記憶體佔用,類全名資訊.live子參數,僅僅統計活的對象數量.

> jmap -histo:live 6824

 num     #instances         #bytes  class name----------------------------------------------   1:          1232         238144  [C   2:           414          48184  <constMethodKlass>   3:            69          32712  [B   4:           414          29864  <methodKlass>   5:            60          29512  <constantPoolKlass>   6:          1084          26016  java.lang.String


2、列印永久代中classloader的相關資訊

>jmap -permstat 6824
class_loader    classes bytes   parent_loader   alive?  type<bootstrap>     382     1684072   null          live    <internal>0x2a3a7fe0      0       0         null          live    sun/misc/[email protected]0x2a3aa748      6       51592   0x2a3a7fe0      live    sun/misc/[email protected]

3、顯示對記憶體的分配和使用方式,對於瞭解jvm記憶體配置非常實用,會顯示年輕代、老年代和永久代的相關記憶體資訊。
>jmap -heap 6824
using thread-local object allocation.Mark Sweep Compact GCHeap Configuration:   MinHeapFreeRatio = 40

4、最經常使用的擷取記憶體dump

jmap -dump:live,format=b,file=m.hprof 6824 
能夠參考http://blog.csdn.net/aitangyong/article/details/24012535這篇部落格


jmap命令(Java Memory Map)的使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.