Why do I want to find Duplicate Rows using the HPROF Viewer and Analyzer?

Using the Android memory monitor, especially its Dump Java Heap feature, I was currently looking for memory leaks in my application. To the left of viewing the Android / HPROF dump, you can open the "Analyzer Tasks", and there you can tell the machine "Leak Detection" and "Find Duplicate Lines". The last option puzzles me. What does he do and how is it useful? It should be more complicated than just helping those awkward developers among us who put the same line into their resource folder twice. The docs are not very useful here (if my search was sufficiently complete), because they claim that it helps in cases where the target program has lines that repeat the values. "When will this be?

+8
android android-studio heap-dump hprof
source share
1 answer

As far as I know, this just points to duplicate lines in memory. However, this is useful not only for finding cases when the same line has been entered into several resources. For example, since Strings are immutable in Java, you can easily get many instances of strings than you might have realized. If your application has a lot of string concatenation code but doesn't use StringBuilder, or if your application does some kind of string and text processing, it's pretty easy to end up with an unexpectedly large amount of string space. But on the contrary, it is often possible to do a relatively easy optimization to get some space (as soon as you see what the problem is). So you could say that this task is more about optimizing memory, rather than detecting a leak.

+3
source share

All Articles