Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incremental memory usage of Android Studio

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.

enter image description here

And below is the description of each process.

enter image description here

enter image description here

enter image description here

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?

like image 328
Amit Bhandari Avatar asked Jun 13 '18 10:06

Amit Bhandari


1 Answers

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!

like image 50
Amit Bhandari Avatar answered Sep 28 '22 14:09

Amit Bhandari