Finding and fixing Android memory leaks with Perfetto, SQL, and AI agents (perfetto.dev)
16 points by lalitmaganti a day ago
saagarjha an hour ago
In my experience trying to track down memory leaks in Android is kind of difficult since I couldn't find a good tool that would record all allocation traffic. There's stuff that will capture a Java heap snapshot, some things will interpose malloc and free, but there's not really a one-stop thing that does both that I could find. The best option I could see was the profiler in Android Studio, which was super buggy and had very few correlation features :(
lalitmaganti an hour ago
While this article is focused on the Java heap dump side of Perfetto, we do support both native and Java heap dumps in a single trace.
Recently we've also been investing into a new feature of the UI called Memscope (https://perfetto.dev/docs/visualization/memscope) to put this behind a one-click graphical interface which hides all the complex configuration options of Perfetto and "just works" collecting both Java heap dumps and native heap profiling.
On the analysis side, we then time align them and present it with a new exploration UI. This is still under very active development so it should continue getting better with time :)
saagarjha 44 minutes ago
How does this work? Is it sampling the heap or tracking all allocations?
lalitmaganti 38 minutes ago
cute_boi an hour ago
Duh!
I got excited, only to get angry after reading the first paragraph. If you want me to invest my time and read it, please make sure you write it yourself and not generally everything using AI. I’m not against AI, but articles like these make my blood boil.