Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "MemoryAnalyzer/OQL"

(Object Query Language)
(OQL (Memory Analyzer) versus SQL (MAT/Calcite))
Line 54: Line 54:
 
|-
 
|-
 
|General syntax
 
|General syntax
|SELECT s FROM java.lang.String
+
|<code>SELECT s FROM java.lang.String</code>
|SELECT s.this FROM java.lang.String
+
|<code>SELECT s.this FROM java.lang.String</code>
 
|-
 
|-
 +
|Built-in functions
 +
|<code>SELECT toString(s), classof(s), s.@objectAddress, s.@usedHeapSize, s.@retainedHeapSize FROM java.lang.String s </code>
 +
|<code>SELECT toString(s.this),getType(s.this),getAddress(s.this),shallowSize(s.this),retainedSize(s.this) FROM "java.lang.String" s</code>
 
|}
 
|}

Revision as of 05:26, 14 November 2019

Object Query Language

Object Query Language is an SQL like language used by Memory Analyzer for exploring a heap dump.

Simple

SELECT * FROM java.lang.String

Displays all String objects as a tree.

SELECT s as String,s.value as "characters" FROM java.lang.String s

Displays all String objects as a table.

SELECT s as String,s.value as "characters", inbounds(s),inbounds(s).@length FROM java.lang.String s

String                          |characters                                 |inbounds(s)| inbounds(s).@length
--------------------------------------------------------------------------------------------------------------
java.lang.String [id=0x22e58820]|char[] [id=0x22e60f50;length=16;size=48]   |[I@620f7a39|                   1
java.lang.String [id=0x22e59150]|char[] [id=0x22e62ff0;length=6;size=24]    |[I@1f7b8d59|                   1
java.lang.String [id=0x22e5b560]|char[] [id=0x22e6b730;length=537;size=1088]|[I@28551755|                   1
--------------------------------------------------------------------------------------------------------------

There are two sorts of objects encountered with OQL, IObject which represent Java objects in the snapshot and regular Java objects generated by OQL processing.

java.lang.String [id=0x22e58820] is a IInstance representing a String from the snapshot.

char[] [id=0x22e60f50;length=16;size=48] is an IPrimitiveArray representing a character array from the snapshot.

[I@620f7a39 is a regular Java integer array holding a several of ints which are the object IDs Memory Analyzer uses to represent IObjects in the snapshot.


OQL (Memory Analyzer) versus SQL (MAT/Calcite)

As well as the built-in OQL, there is an extension plug-in for MAT called MAT Calcite which adds SQL processing

Topic OQL SQL
General syntax SELECT s FROM java.lang.String SELECT s.this FROM java.lang.String
Built-in functions SELECT toString(s), classof(s), s.@objectAddress, s.@usedHeapSize, s.@retainedHeapSize FROM java.lang.String s SELECT toString(s.this),getType(s.this),getAddress(s.this),shallowSize(s.this),retainedSize(s.this) FROM "java.lang.String" s

Back to the top