OQL in 1 minute

OQL is the build-in object query language. Learn to perform custom SQL-like queries on the heap dump in one minute.

Open the heap dump

Open a sample heap dump by activating the action link below.

FROM Clause

Think of classes as tables, objects as rows, and fields as columns.
SELECT * FROM java.lang.ref.SoftReference
This query will return all soft reference objects. To include objects of subclasses, add the INSTANCEOF keyword:
SELECT * FROM INSTANCEOF java.lang.ref.Reference

WHERE Clause

To conditionally select objects, a WHERE clause can be added to the SELECT statement:
SELECT * FROM java.lang.String s WHERE s.count > 100
Possible operators are =, !=, <, <=, >, >= and LIKE. Fields can be addressed with dot notation to reach fields of a table alias or even fields of nested objects: <field>.<field>.<field>.

SELECT Clause

To select the content of specific fields, use a SELECT statement like this:
SELECT toHex(m.@objectAddress), m.size, m.table.@length, m.@retainedHeapSize FROM java.util.HashMap m
The @ symbol denotes fields and methods (from the Java API) like objectAddress, usedHeapSize, retainedHeapSize, GCRootInfo and length (for arrays). Functions like toHex(), toString(), classof(), dominatorof() etc. allow simple transformations.