Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle leaves java as a process even after closing android studio

On mac system whenever i close android studio it leaves java process and java process keep running and keep hogging the ram memory.Having a mac with only 4gb is sometime painful if you see that java process is taking upto 1gb of ram enter image description here

enter image description here

is there any option in android studio so that as soon as i quit all the process related to it should be closed or any command that i can run for cleanup?

like image 559
Ankur Avatar asked Aug 30 '15 19:08

Ankur


3 Answers

From the documentation:

Daemon processes will automatically terminate themselves after 3 hours of inactivity. If you wish to stop a Daemon process before this, you can either kill the process via your operating system or run the gradle --stop command. The --stop switch causes Gradle to request that all running Daemon processes, of the same Gradle version used to run the command, terminate themselves.

like image 182
JB Nizet Avatar answered Nov 14 '22 21:11

JB Nizet


No option in Android Studio AFAIK. One way to cleanup would be create a shell script that launches Android Studio and then kills off any leftover java processes afterwards e.g.

#!/bin/sh
studio.sh
pkill -f gradle-launcher
like image 29
IanB Avatar answered Nov 14 '22 21:11

IanB


It happens because Android Studio uses gradle daemon by default (see here) and as far as I know it can't be turned off. Have a look here also - gradle daemon should time out after 3 hours.

like image 1
Opal Avatar answered Nov 14 '22 23:11

Opal