Memory Analysis記憶體分析工具複習

來源:互聯網
上載者:User

最近因為系統問題,所以又對Memory Analysis工具進行複習(for eclipse的)

通過dump出來的檔案,然後在eclipse上用Memory Analysis工具(可以線上安裝很簡單)

記憶體流失尋找思路一:

開啟Leak Suspects->Problem Suspect N下的“Details”

開啟此頁面後,有幾個內容:

1、引用累計關係(shortest paths to the accumulation point)

2、儲存物件(accumulated objects)

3、儲存物件所屬類名(accumulated objects by Class)

 

這種方式很簡單並且很直觀,知道那些對象了去尋找類和引用點。

 

記憶體流失尋找思路二:

1、開啟長條圖(Histogram),過濾找到自己的類,然後在此記錄上右鍵“list objects”下選擇“with incoming references”

得到是那些對象引用了此類。

2、再從這些對象記錄選擇一條右鍵“Path to GC Roots”->"exclude weak references",得到層次參考關聯性,就知道了point。

如果對代碼很熟悉,能猜出是那個類會引起泄漏,就可以用這種方式

 

 

備忘: Shallow vs. Retained Heap

Shallow heap is the memory consumed by one object. An object needs 32 or 64 bits (depending on the OS architecture) per reference, 4 bytes per Integer, 8 bytes per Long, etc. Depending on the heap dump format the size may be adjusted (e.g. aligned to 8, etc...) to model better the real consumption of the VM.

Retained set of X is the set of objects which would be removed by GC when X is garbage collected.

Retained heap of X is the sum of shallow sizes of all objects in the retained set of X, i.e. memory kept alive by X.

 

關於相關更詳細的資料可以參考說明和網上資料。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.