Top 3 Essential OQL Queries for Heap Analysis
Master OQL with queries to find all instances of a specific class, filter objects by field values, and identify objects matching regular expressions, crucial for memory leak detection.
The top 3
- Uncover Top Memory-Hogging Object Classes: Identify which classes consume the largest portion of the heap by their retained size, crucial for pinpointing the primary culprits behind memory leaks. This query groups objects by class name and sums their retained memory.
- Detect & Count Duplicate String Instances: Find instances of identical string values that are redundantly stored in memory, providing insights into potential optimizations by using String.intern() or reducing string duplication. This query groups strings by their content and counts occurrences.
- Trace Object Reference Chains to GC Roots: Discover why a specific object or set of objects is not garbage collected by listing all incoming references, which helps identify unintended retention paths and resolve memory leaks. The `referrers()` function is key here.
Sources
Open the full topic