I am using Android studio 3.1.3 (latest build as of writing this) with Gradle 3.1.3.
And don't know if it matters or not but I have recently upgraded to Ubuntu 18.04
Whenever I start Android studio, it starts with very small memory footprint. (single process named java takes around 1GB of RAM)
Now when I start build process, one more java process starts running taking around 500MB of RAM. Still it's no problem as I have 8GB of RAM.
After using studio for about hour or two (includes number of builds as I test on real device), suddenly computer freezes and there are three java process taking up almost 5GB of RAM (approx 2.3, 1.5 and 1.2 GB each). Those processes will not release memory even if studio is seating idle. I have to exit the studio and restart it to make it go away.
Here is the screenshot of my system monitor windows.
And below is the description of each process.
Is anyone else facing this issue? When I was in Ubuntu 16.04 and old android studio, this was not the problem. Does Ubuntu has to do anything with it?
I tried many things from many places from internet but nothing seemed to work.
So I downgraded back to Ubuntu 16.04 and issue is no more happening. Maybe some issue with my setup in 18.04 (which I hardly think might be the reason because I did re-setup from scratch twice and issue still persisted) or might be problem with 18.04 (not blaming!)
Thing is, I did not face problem of ram overflow only in Android studio but IntelliJ and TeamCity setup as well. Somehow many many instances of Java kept running in RAM by OS (sometimes over 10 instances of JVM, couple of which took 2 GB each even after build and everything was finished)
Hope it helps someone!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With