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

Add retained size to reports #166

Closed
wants to merge 1 commit into from
Closed

Add retained size to reports #166

wants to merge 1 commit into from

Conversation

pyricau
Copy link
Member

@pyricau pyricau commented May 30, 2015

Fixes #162

@pyricau
Copy link
Member Author

pyricau commented May 30, 2015

screenshot-2015-05-30_12 49 33 533

@@ -107,6 +107,14 @@ public static void setEnabled(Context context, final Class<?> componentClass,
});
}

/** Based on http://stackoverflow.com/a/3758880. */
public static String humanReadableByteCount(long bytes) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want KiB, MiB, etc. What you have is incorrect.
http://en.wikipedia.org/wiki/Binary_prefix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but most people have no clue what KiB is. MiB... Men in Black?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. But it will be used in context like "Activity has leaked 51.4 KiB", so reader might get it right away.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @sjudd !

@swankjesse
Copy link
Contributor

Super cool.

LGTM

@@ -20,16 +20,17 @@
public final class AnalysisResult implements Serializable {

public static AnalysisResult noLeak(long analysisDurationMs) {
return new AnalysisResult(false, false, null, null, null, analysisDurationMs);
return new AnalysisResult(false, false, null, null, null, 0, analysisDurationMs);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builder would be nice, unless you remember what this third null does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dang. Normally I'm the one writing this sort of comment on PRs. Oh well. I'd argue this is "ok ish" because AnalysisResult has a private constructor and a small surface, so it's all in one place.

I could also extract local variables.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right. I didn't noticed it's private class. Then let's keep it hidden under the carpet :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue that there is too many literals. Extracting local vars seems to be overkill for this though.
Maybe inline comments will make a deal? Like:

return new AnalysisResult(
    false /* leakFound */,
    false /* excludedLeak */,
    null  /* className */, 
    null  /* leakTrace */, 
    null  /* failure */, 
    0     /* retainedHeapSize */, 
    analysisDurationMs);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pepyakin I'm strictly against any non-JavaDocs comments in code. They're not consistent, they're not enforced, they're not utilizing features of IDE. So, either Builder or at least JavaDoc for constructor is better.

@pyricau
Copy link
Member Author

pyricau commented Jul 19, 2015

This PR will never be merged because it relies on MAT. I'm keeping it around until #219 is merged and then I'll redo it with perflib.

@pyricau
Copy link
Member Author

pyricau commented Aug 28, 2015

Newer version: #260

@pyricau pyricau closed this Aug 28, 2015
@pyricau pyricau deleted the py/retained_size branch August 28, 2015 20:50
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.

Add retained size to leak reports
5 participants