Skip to content

Standardize user-facing heap object ID rendering - #2934

Open
shamana-s wants to merge 3 commits into
square:mainfrom
shamana-s:fix-2866-object-id-format
Open

Standardize user-facing heap object ID rendering#2934
shamana-s wants to merge 3 commits into
square:mainfrom
shamana-s:fix-2866-object-id-format

Conversation

@shamana-s

Copy link
Copy Markdown

Fixes #2866

Summary

This PR standardizes heap object ID rendering across Shark by introducing a shared formatting helper and using it consistently across user-facing output.

Object IDs are now rendered in both decimal and hexadecimal form:

331769488 (0x13c4bad0)

This follows the formatting used by Android Studio's Memory Profiler while preserving the decimal ID that Shark APIs and the interactive CLI accept as input.

Changes

  • Added Long.asObjectIdString() as the shared object ID formatting helper.
  • Updated HeapObject.toString() to use the shared formatter.
  • Updated shark-cli interactive object rendering.
  • Updated HeapGraph.findObjectById() "object not found" error message.
  • Updated leak trace labels ("Also retains leaking object...") to use the shared formatter.

Notes

As discussed in #2866, ObjectDominators.renderDominatorTree() was intentionally left unchanged because the issue suggests deciding object index vs. object ID rendering separately.

@CLAassistant

CLAassistant commented Aug 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@pyricau

pyricau commented Aug 7, 2026

Copy link
Copy Markdown
Member

Thanks! I'm OoO on vacation for a bit, but I'll pick this up when I'm back.

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.

Standardize how heap object ids are rendered in user facing output

3 participants