I’m using heap snapshots to debug a potential memory issue. As the documentation indicates objects are shown in this format:
Where NumericIdentifier is:
This is an object ID. Displaying an object’s address makes no sense, as objects are moved during garbage collections. Those object IDs are real IDs — that means, they persist among multiple snapshots taken. This allows precise comparison between heap states. Maintaining those IDs adds an overhead to GC cycles, but it is only initiated after the first heap snapshot was taken — no overhead if heap profiles aren’t used.
I’m wondering if the identifiers are guaranteed to be monotonically increasing? That is given:
Can I rely on the first object to be older (was allocated before) than the second one?
If yes – how strong is the guarantee? (Does it hold between constructor names for instance?)