Skip to content

Commit

Permalink
only compute resource leak hint once to save memory
Browse files Browse the repository at this point in the history
  • Loading branch information
yawkat committed Jan 6, 2025
1 parent 55cfbda commit 5309078
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ static void reportStillOpen() {
private record Leak(String resourceType, String records) {}

private static class FixedHint implements ResourceLeakHint {
private final byte[] associatedInput;
private final String msg;

private FixedHint(byte[] associatedInput) {
this.associatedInput = associatedInput;
this.msg = "Associated input: " + (associatedInput == null ? "<none>" : Base64.getEncoder().encodeToString(associatedInput));
}

@Override
public String toHintString() {
return "Associated input: " + (associatedInput == null ? "<none>" : Base64.getEncoder().encodeToString(associatedInput));
return msg;
}
}
}

0 comments on commit 5309078

Please sign in to comment.