Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce additional ways to represent object ids #2365

Merged
merged 1 commit into from
Apr 19, 2022
Merged

Introduce additional ways to represent object ids #2365

merged 1 commit into from
Apr 19, 2022

Conversation

pyricau
Copy link
Member

@pyricau pyricau commented Apr 19, 2022

  • Object.toString() and the Java Debugger use Integer.toHex(System.identityHashCode(obj)). This is now available as an Android only extension on HeapInstance, as ART stores the identity hash code in Object.shadow$_monitor_
  • YourKit Java Profiler uses the object's 1-based index in the heap dump as identifier, so this adds support for it as well, albeit in a non natural way: not on HeapObject but as a find method on HeapGraph because computing this isn't cheap (need to scan the entire index).
  • Android Studio profiler displays a masked version of the object id to avoid negative ids when the id byte size isn't 8.

These utilities should help navigate between tools and find the same object in various tools.

Screenshots from YourKit and AS:
image
image

- `Object.toString()` and the Java Debugger use `Integer.toHex(System.identityHashCode(obj))`. This is now available as an Android only extension on HeapInstance, as ART stores the identity hash code in `Object.shadow$_monitor_`
- YourKit Java Profiler uses the object's 1-based index in the heap dump as identifier, so this adds support for it as well, albeit in a non natural way: not on HeapObject but as a find method on HeapGraph because computing this isn't cheap (need to scan the entire index).
- Android Studio profiler displays a masked version of the object id to avoid negative ids when the id byte size isn't 8.

These utilities should help navigate between tools and find the same object in various tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant