- System requirements
- Profiler architecture
- Running the profiler
- Profiler activation
- Start profiling
- Solving performance problems
- CPU profiling
- Deadlock detector
- Memory profiling
- Memory telemetry
- Memory snapshot
- Object allocation recording
- Shallow and retained sizes
- Memory views
- Memory inspections
- Comparing memory snapshots
- Support of HPROF format snapshots
- Support of Java Flight Recorder (JFR)
- Support of Portable Heap Dumps (.phd)
- Values of primitive types
- Persistent object IDs
- Useful actions
- Set description language
- Garbage collection
- Monitor profiling
- Exception profiling
- Probes: monitor events of various kinds
- Performance Charts
- Inspections: automatic recognition of typical problems
- Automatically trigger actions on event
- Summary, snapshot annotation, automatic deobfuscation
- Time measurement (CPU time, wall time)
- Snapshot directory customization
- Export of profiling results to HTML, CSV, XML, plain text
- Profiler Java API
- Profiler HTTP API
- Command line tool to control profiling
- FAQ: How to profile in my scenario?
Persistent object IDs
An object in Java heap does not have a concept of persistent ID:
- internally, JVM refers to objects via their physical memory addresses which may change during garbage collection if heap regions are moved or compacted;
object's identity hash code returned with the method
java.lang.System.identityHashCode(Object)is persistent, but it's not an ID: more than one object may have the same identity hash code.
To make object identification possible, the profiler provides means to explicitly assign a persistent ID to particular objects, with the help of JVMTI object tagging. Tagging all objects is impractical because that would increase profiling overhead, JVM memory footprint and garbage collection times.
How objects can be assigned the persistent ID
By calling the profiler API static method
long com.yourkit.probes.JVM.getPersistentObjectId(Object). This is the most direct and explicit way to assign the ID. Classpath requirements for using this API are explained here.
In probes via table API:
com.yourkit.probes.ObjectColumnis intended to record the persistent object ID, allowing to associate objects in a memory snapshot with events. For example, built-in probes for databases and file objects use it to identify the resources.
In a trigger for method invocation:
- Objects whose method calls were recorded with the trigger action "Record Method Invocation" will be assigned the persistent ID. The objects can be seen in a memory snapshot (see below).
Print*actions have the parameter
PERSISTENT_ID. Corresponding objects will be assigned the persistent ID, and the actions will output it. The IDs can be matched to objects in a memory snapshot (see below).
Important: to have access to corresponding object detail, a memory snapshot should be captured. A performance snapshot is not enough: it contains the IDs as numbers in events, but with no further information about the objects is available.
Persistent object ID presentation in the profiler UI
When a memory snapshot is opened, the persistent IDs can be seen and searched for.
if an object has been assigned the persistent ID,
it is shown in Object explorer prefixed with
- in Events tab: if the object corresponding to the event still exists, i.e. has not yet been collected, the hyperlink opens the object in an object explorer.
Memory | (Find) Objects by Persistent IDsearches for objects with particular IDs, or for all objects with the ID assigned.