I'm running Android Studio on an underpowered machine, and when I was monitoring Android Studio's memory consumption I noticed multiple "java" processes, some even forking another process as a child and some taking as much as up to 1 GB!
Is this normal behavior or is it the result of a misconfiguration?
And how can I configure this to work with less number of java processes?
Will changing the project's JDK and Gradle to an externally installed (more recent version) help rather than using the ones shipped with Android Studio?
Limited Java compiler and Gradle to 512mb and updated Gradle to the latest supported version by Android Gradle plugin and that remedied the high memory use to some extent, now only noticing 3 java processes max and each around 512mb.
For anyone curious these are the flags I used:
Android Studio Custom VM options:
-Xms512m
-Xmx512m
-XX:+UseCompressedOops
-XX:+HeapDumpOnOutOfMemoryError
gradle.properties :
org.gradle.jvmargs = -Xms512m -Xmx512m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError
Fixed heaps's start and max size to 512mb to avoid recalculation. Thanks to everybody who answered.