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

MemoryAnalyzer/OQL

< MemoryAnalyzer
Revision as of 06:25, 14 November 2019 by Andrew johnson.uk.ibm.com (Talk | contribs) (OQL (Memory Analyzer) versus SQL (MAT/Calcite))

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 s SELECT s.this FROM "java.lang.String" s
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
More functions SELECT h, h[0:-1].size(), h.table, h.table.@length, h.modCount, h.getField("modCount") FROM java.util.HashMap h SELECT h.this,getSize(h.this),h.this['table'],length(h.this['table']), h.this['modCount'], getField(h.this,'modCount') FROM "java.util.HashMap" h

Back to the top