JakeWharton / hugo

Annotation-triggered method call logging for your debug builds.
Apache License 2.0
7.92k stars 797 forks source link

Take care if the arguments are too big! #151

Open crearo opened 7 years ago

crearo commented 7 years ago

I spent about half an hour debugging a particular part of my code later to realize it was the @DebugLog annotation that was causing the huge delay! One of the arguments was a byte array (of an image, hence huge) and I suppose printing that to Logcat was the bottleneck. Shouldn't hugo smartly not print any argument that's just too huge? Or this could be a parameter (if it already isnt there!).

rupinderjeet commented 7 years ago

same here, byte[] causes OutOfMemory exception.

From Firebase Crash Report: OOM in AbstractStringBuilder.enlargeBuffer

java.lang.AbstractStringBuilder.enlargeBuffer (AbstractStringBuilder.java:94)
java.lang.AbstractStringBuilder.append0 (AbstractStringBuilder.java:145)
java.lang.StringBuilder.append (StringBuilder.java:216)
hugo.weaving.internal.Strings.byteArrayToString (Strings.java:102)
hugo.weaving.internal.Strings.arrayToString (Strings.java:71)
hugo.weaving.internal.Strings.toString (Strings.java:23)
hugo.weaving.internal.Hugo.enterMethod (Hugo.java:63)
hugo.weaving.internal.Hugo.ajc$inlineAccessMethod$hugo_weaving_internal_Hugo$hugo_weaving_internal_Hugo$enterMethod (Hugo.java:1)
hugo.weaving.internal.Hugo.logAndExecute (Hugo.java:36)