How to clear memory used by Android studio

Ankit Goyal
2 min readAug 23, 2018

I hope many of you may have experienced that Android studio becomes slow post using it for some time. The reason for this is it keeps all actions in memory and increase java heap of it. Some people suggest to increase java heap memory of it but that will not solved the problem but postponed it.

So How to solve it?

very simple, in Android studio(I hope all intellij based IDE) has an option for this.

Steps 1 enable memory view(if not done yet):

  1. Go to preferences(command+,)
  2. Search for memory.
  3. Inside Appearance & Behavior -> Appearance-> Window options -> enable show Memory indicator

4. Apply changes and we are good to go.

5. Now Studio will start showing Allotted Heap memory vs Used graph in right bottom corner of the editor.

right bottom corner of editor

you can observe that it will keep increasing as time goes. whenever you feel Studio is bit slow just click on this graph; yes just one click on it and it will clear up memory.

Very simple right? If you want to know something more about IDE feature or face any issue let me know in comments/response.

Update: This works with other product of Intellij, checked with IntelliJ IDEA CE and Webstorm. Thanks Anthony Sierra for confirming this.

I had published 3 other stories in past for increase productivity while using Intellij Products Color My Logs, Remove prefix from getter, Debugger mode

--

--

Ankit Goyal

Android Platform team member at Walmart Global Tech