java oql_深入理解java虛擬機(八):java內存分析工具-MAT和OQL

以下內容翻譯自MAT幫助文檔。

一、Class Histogram

Class Histogram shows the classes found in the snapshot, the number of objects for each class, the heap memory consumption of these??objects, and the minimum retained size of the objects

二、Dominator tree

Dominator tree shows for a particular object which other objects depend on it and will be garbage collected if that particular?object becomes unreachable.

三、Paths to GC roots

This view find objects responsible for keeping the selected object in the heap.

Componenet report?A heap dump contains many objects. But which of those belong to your component? And what conclusions can you draw from them??This is where the Component Report can help。

四、OQL

OQL is the build-in object query language. Learn to perform custom SQL-like queries on the heap dump in one minute.?classes as tables, objects as rows, and fields as columns。

1、OQL-SELECT

1.SELECT * FROM java.lang.String

2.SELECT toString(s), s.count, s.value FROM java.lang.String s

3.SELECT toString(s) AS Value,s.@usedHeapSize AS “Shallow Size” FROM java.lang.String s

(@為屬性訪問器,可以使用AS起個別名)

4.SELECT AS RETAINED SET * FROM java.lang.String

(使用AS RETAINED SET 獲得與選擇對象相關聯的對象集合)

5.SELECT OBJECTS dominators(s) FROM java.lang.String s

(OBJECTS 關鍵字使得dominators 返回二維數組簡化為一維對象列表)

6.SELECT DISTINCT OBJECTS classof(s) FROM java.lang.String s

(DISTINCT 去重復)

7、查詢所有的異常對象SELECT * FROM INSTANCEOF java.lang.Exception exceptions

SELECT?exceptions.@displayName, exceptions.detailMessage.toString() FROM INSTANCEOF java.lang.Exception exceptions

2、OQL-FROM

1.SELECT * FROM “java\.lang\..*”

(支持正則)

2.SELECT * FROM java.lang.String

3.SELECT * FROM 0xe14a100

(根據類對象在堆轉儲快照中的地址查詢)

4.SELECT * FROM 3022

(根據對象在堆轉儲快照中的地址ID)

5.SELECT * FROM ( SELECT * FROM java.lang.Class c )

6.SELECT * FROM?${snapshot}.getClasses()(使用屬性訪問器)

7.SELECT * FROM INSTANCEOF java.lang.ref.Reference

(INSTANCEOF會把指定類的子類也查詢出來)

8.SELECT * FROM OBJECTS java.lang.String

(OBJECTS禁止OQL把查詢范圍解釋為對象實例,上述結果為java.lang.String對應的Class)

3、OQL-WHERE

1.SELECT * FROM java.lang.String s WHERE s.count >= 100

2.SELECT * FROM java.lang.String s WHERE toString(s) LIKE “.*day”

3.SELECT * FROM java.lang.String s WHERE s.value NOT IN dominators(s)

4.SELECT * FROM java.lang.String s WHERE toString(s) = “monday”

5.SELECT * FROM java.lang.String s WHERE s.count > 100 AND?s.@retainedHeapSize?>?s.@usedHeapSize

6.SELECT * FROM java.lang.String s WHERE s.count > 1000 OR?s.value.@length?>1000

7.SELECT * FROM java.lang.String s WHERE (s.count > 1000) = true

WHERE toString(s) = “monday”

WHERE dominators(s).size() = 0

WHERE s.retainedHeapSize > 1024L

WHERE?s.@GCRootInfo?!= null

4、屬性訪問器

1.[.]..……

(訪問堆轉儲快照中對象的字段)

2.[.]@……

(訪問java bean屬性)

目標

接口

屬性

含義

任意堆中的對象

Iobject

objectId

快照中對象的ID

objectAddress

快照中對象的地址

Class

對象所屬的類

usedHeapSize

對象的shallowSize

retainedHeapSize

對象的retainedSize

displayName

對象的顯示名稱

類對象

Iclass

classLoaderId

類加載器Id

任意數組

Iarray

length

數組的長度

5、OQL 內建函數

.[.]@([,])……

(調用OQL java方法,加“()”會令MAT解釋為一個OQL java調用)

常見的OQL java方法

目標

接口

屬性

含義

$snapshot

Isnapshot

getClasses()

獲取所有類的集合

getClassesByName(String name,boolean includeSubClasses)

獲取指定類的集合

Class object

Iclass

hasSuperClass()

如果對象有父類則返回true

isArrayType()

如果Class是數組類型則返回true

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/541462.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/541462.shtml
英文地址,請注明出處:http://en.pswp.cn/news/541462.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

《Python數據分析與挖掘實戰》一1.2 從餐飲服務到數據挖掘

本節書摘來自華章出版社《Python數據分析與挖掘實戰》一書中的第1章,第1.2節,作者 張良均 王路 譚立云 蘇劍林,更多章節內容可以訪問云棲社區“華章計算機”公眾號查看 1.2 從餐飲服務到數據挖掘 企業經營最大的目的就是盈利,而餐…

obj[]與obj._Ruby中帶有示例的Array.include?(obj)方法

obj[]與obj.Ruby Array.include&#xff1f;(obj)方法 (Ruby Array.include?(obj) Method) In the previous articles, we have seen how we can check whether two Array instances are identical or not with the help of <> operator, operator, and .eql? method?…

java javah_Java開發網 - 一個javah的問題

Posted by:jerry_xuPosted on:2006-03-13 15:39我在環境變量中已經設置了path為D:\Program Files\Java\jdk1.5.0_06&#xff0c;ClassPath設置為.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;class的路徑為&#xff1a;D:\JNItest\bin\jni\Hello.class &#xff0c;但是…

《Python面向對象編程指南》——2.7 __del__()方法

本節書摘來自異步社區《Python面向對象編程指南》一書中的第2章&#xff0c;第2.7節&#xff0c;作者&#xff3b;美&#xff3d;Steven F. Lott&#xff0c; 張心韜 蘭亮 譯&#xff0c;更多章節內容可以訪問云棲社區“異步社區”公眾號查看。 2.7 __del__()方法 __del__()方…

NullReferenceException C#中的異常

什么是NullReferenceException&#xff1f; (What is NullReferenceException?) NullReferenceException is an exception and it throws when the code is trying to access a reference that is not referencing to any object. If a reference variable/object is not refe…

java map key 大寫轉小寫_Spring JdbcTemplate 查詢出的Map,是如何產生大小寫忽略的Key的?(轉)...

Java 是區分大小寫的&#xff0c;普通的Map例如HashMap如果其中的key"ABC" value"XXX"那么map.get("Abc") 或 map.get("abc")是獲取不到值得。但Spring中產生了一個忽略大小寫的map使我產生了好奇例如 jdbcTemplate.queryForList(sql)…

《iOS 6核心開發手冊(第4版)》——2.11節秘訣:構建星星滑塊

本節書摘來自異步社區《iOS 6核心開發手冊&#xff08;第4版&#xff09;》一書中的第2章&#xff0c;第2.11節秘訣&#xff1a;構建星星滑塊&#xff0c;作者 【美】Erica Sadun&#xff0c;更多章節內容可以訪問云棲社區“異步社區”公眾號查看 2.11 秘訣&#xff1a;構建星星…

css框架和js框架_優雅設計的頂級CSS框架

css框架和js框架Brief discussion: 簡要討論&#xff1a; Well, who doesnt want their website or web page to look attractive, stylish and be responsive? 那么&#xff0c;誰不希望自己的網站或網頁看起來有吸引力&#xff0c;時尚并且ReactSwift&#xff1f; We put …

軟考下午題具體解釋---數據流圖設計

在歷年的軟考下午題其中&#xff0c;有五道大題。各自是數據流圖的設計&#xff0c;數據庫設計&#xff0c;uml圖&#xff0c;算法和設計模式&#xff0c;從今天這篇博文開始&#xff0c;小編就跟大家來一起學習軟考下午題的相關內容。包含理論上的知識以及典型例題的解說&…

基本程序 打印Scala的Hello World

Scala中的基本程序 (Basic program in Scala) As your first Scala program, we will see a basic output program that just prints "Hello World" or any other similar type of string. With this example, we will see what are the part of the code that is im…

java treemap lastkey_Java TreeMap lastKey()用法及代碼示例

java.util.TreeMap.lastKey()用于檢索Map中存在的最后一個或最高鍵。用法:tree_map.lastKey()參數&#xff1a;該方法不帶任何參數。返回值&#xff1a;該方法返回映射中存在的最后一個鍵。異常&#xff1a;如果映射為空&#xff0c;則該方法將引發NoSuchElementException。以下…

mysql屬于數據庫三級模式_數據庫系統的三級模式指的是什么

數據庫系統的三級模式指的是什么發布時間&#xff1a;2020-10-26 10:11:21來源&#xff1a;億速云閱讀&#xff1a;52作者&#xff1a;小新小編給大家分享一下數據庫系統的三級模式指的是什么&#xff0c;希望大家閱讀完這篇文章后大所收獲&#xff0c;下面讓我們一起去探討吧&…

《自頂向下網絡設計(第3版)》——導讀

目錄 第1部分 辨明客戶的需求和目標 第1章 分析商業目標和制約 1.1 采用自頂向下的網絡設計方法 1.2 分析商業目標 1.3 分析商業制約 1.4 商業目標檢查表 1.5 小結 1.6 復習題 1.7 設計環境 第2章 分析技術目標與折衷措施 2.1 可擴展性 2.2 可用性 2.3 網絡性能 2.4 安全性 2…

python矩陣變化_用numpy改變矩陣的形狀

我的問題有兩個方面。我有下面的代碼來處理一些矩陣。在import numpytupleList [(0, 122), (1, 246), (2, 157), (3, 166), (4, 315), (5, 108), (6, 172), (7, 20), (8, 173), (9, 38), (10, 28), (11, 72), (12, 102), (13, 277), (14, 318), (15, 316), (16, 283), (17, 31…

最小硬幣問題_進行更改的最小硬幣數量

最小硬幣問題Description: 描述&#xff1a; This is classic dynamic programming problem to find minimum number of coins to make a change. This problem has been featured in interview rounds of Amazon, Morgan Stanley, Paytm, Samsung etc. 這是經典的動態編程問題…

java 生成xml亂碼_jdom解決中文亂碼問題 JAVA生成xml文件幫了我很大的忙

決解了數據庫讀取出來 再保存到xml 產生的亂碼問題import java.io.FileOutputStream;import java.io.IOException;import java.io.OutputStreamWriter;import org.jdom.Attribute;import org.jdom.Document;import org.jdom.Element;import org.jdom.output.Format;import org.…

給定重量上限,背包問題_滿足給定重量的袋子的最低成本

給定重量上限,背包問題Problem statement: 問題陳述&#xff1a; You are given a bag of size W kg and you are provided costs of packets different weights of oranges in array cost[] where cost[i] is basically cost of i kg packet of oranges. cost[i] -1 means t…

springMVC rest風格

1.dispatcherServlet的配置<!-- The front controller of this Spring Web application, responsible for handling all application requests --><servlet><servlet-name>springDispatcherServlet</servlet-name><servlet-class>org.springfram…

sql2008能否打開mysql數據庫_mysql數據庫數據能不能導入到sql server中

點“測試”按鈕確認你的鏈接是正確的。 Press the "Test" button to ensure your connection settings are set properly and then the "OK" button when youre done.二. 創建Microsoft SQL到MySQL的鏈接1.在SQL Server Management Studio中打開一個new qu…

c語言 函數的參數傳遞示例_isunordered()函數與C ++中的示例

c語言 函數的參數傳遞示例C isunordered()函數 (C isunordered() function) isunordered() function is a library function of cmath header, it is used to check whether the given values are unordered (if one or both values are Not-A-Number (NaN)), then they are u…