JetBrains plugin JVM Debugger Memory View JetBrains JVM Debugger Memory View plugin During my recent R&D activities looking for new tools to improve my development experience and making life easier with Studio, I found a useful plugin which I have never heard before. This is why I decided to write about this mighty and how it helps me with memory debugging my applications. Android tool What is the plugin about? According to : plugin page This plugin extends the built-in JVM debugger with capabilities to during a debug session. explore objects in the JVM heap The Memory View shows you the grouped by their class name. total number of objects in the heap When you’re stepping over the code, the . This way you can easily see how the code you’re stepping over affects the heap. Diff column shows how the number of objects changes between debugger stops A double click on a class name opens a dialog with instances of this class. The dialog lets you . All debugger operations such as Inspect, Mark Object, Evaluate Expression, Add to Watches, etc can be applied to instances in this dialog. filter instances by an evaluated expression Since all the sentences are really interesting, I understand if you want to go and download this plugin to have your own experiences instead of reading more here… BOLD How to install this wonderful plugin? Open Android Studio page: Plugins Shortcut: press command/ctrl + shift + A , type Plugins and press enter or open (Mac: Android Studio -> Preferences Windows & Linux: File -> Settings) and find page: Preferences/Settings: / Plugins press button and search for and . Install JetBrains plugin… JVM Debugger Memory View Install then you have to restart the Android Studio. At first glance: After getting back to Android Studio you will find added to right side of the toolbar. Memory View Tool Window Memory View Tool Window If you do not see the Memory View, to open the tool window, use the main menu: → → . View Tool Windows Memory View First of all, this tool only works and show data while the app is running in and you have paused the run using a . debug mode BreakPoint Secondly, I have to mention that, I read about some warnings and bugs that might happen with Android Studio, which I didn’t face during my experience. : version for Android Studio contains few restrictions: WARNING - Getting a large number of instances may fail and stop VM due to Android memory limitations. - Android Studio may freeze, see this bug Let’s debug! After running you app in debug mode and pausing on a BreakPoint you will see the magic happens: One of the most interesting points about this table is the column while stepping through your code lines you will see how many new instances of objects have been created or destroyed! Diff I want to look for my own object , so I search for it: (i.e ProfileModel class) As you can see I have updated the ProfileModel variable in this line of code and I get the Diff +1 before GC remove the old one and also can access the old one which was not possible before. By double clicking on this record I will get instances of the ProfileModel class inside a window: This window also allows you to filter instances by an evaluated expression using the class methods, for instance, you can use method of class to filter unsuccessful responses loaded in memory: isSuccessful OkHttp Response Instances filter feature Another useful feature is Tracking new instances, which you can enable by the right click menu inside Memory View Tool Window: This feature helps you with tracking codes which have been generated the new instance of the class! You can read more about this plugin inside , and also let them know about new features that might come to your mind or bugs if you find some. JetBrains blog TL;DR: This article was about a JetBrains plugin which might help you in memory debugging your applications with Android Studio and access to all loaded objects during an application run. Thanks for reading this article. Please leave a comment and share with us your experience with this plugin and how you find it useful during your own tests. I found this plugin useful so I decided to share it with you, recommend this to your friends if you think it is useful and let them enjoy, too. You can also and follow me for more articles . Mohsen Mirhoseini Argi _I am a senior Android Developer with about nine years experience in the field of Computer Software engineering. I have…_mirhoseini.info Mohsen Mirhoseini - Senior Android Developer