-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Display retain object size using human readable output #1956
Comments
The size is current printed here: https://github.com/square/leakcanary/blob/main/shark/src/main/java/shark/LeakTrace.kt#L143 That module does not have access to the Android APIs. We should probably go with the SI (ie 1 KB = 1000 B) |
Also, funny story, the older version of that stack overflow version (which was flawed) is already in LeakCanary: Line 132 in 5983eae
|
Ok I'll try implementing it myself given this output. |
@pyricau Another question, where should I put the impl of |
I've also noticed such output in |
@pyricau maybe I missed something regarding GitHub issues flow but the issue is still opened despite being referenced in a commit message of a merged PR. Maybe I should have used a verb like "closes" or "fixes" while mentioning the issue in my commit message? (Note: Sorry if it's silly questions, I'm not used to GitHub PR from forks, I use BitBucket server at work and use GitHub on my own with self review for personal projects, not used to collaborate a lot with GitHub) |
Yep the best way is to include "Fixes #number " in the commit message, then when its merge the issue auto closes. I should have closed it manually but forgot. |
Thanks for explanation and your patience 🙇 |
Problem description
Since v2.5, retained objects size is displayed ( 👍 ) as byte amount, would be nice to have a more user friendly output like
du -h
does for instance.Having MB of leak vs bytes might be more alerting.
Potential solutions
If this part of the code depends on Android APIs, Formatter.formatFileSize might be used.
Otherwise, implementing should be feasible using this kind of algorithm: https://stackoverflow.com/a/3758880
The text was updated successfully, but these errors were encountered: