3 ms·
The past couple of days I took a deeper look into the RAM usage of Android Studio as I had my fair share of problems with it. I'm not sure what the 3GB you ment
by Dunedan 8y ago
The past couple of days I took a deeper look into the RAM usage of Android Studio as I had my fair share of problems with it. I'm not sure what the 3GB you mentioned include, but I made the following observations:
- Android Studio itself: default heap size of 1280MB[1] plus ~400MB of metaspace
- Gradle: That's the part which surprised me the most:
- Most projects probably have a custom heap size set for Gradle. Turns out: If you're using Kotlin the same amount of heap size is also used for the Kotlin compile daemon. So if you configure -Xmx2G you'll end up with 2GB for the Gradle daemon and 2GB for the Kotlin compile daemon. The heap size for the Kotlin compile daemon can be separately configured by setting `-Dkotlin.daemon.jvm.options=-Xmx<xxx>`[2].
- Gradle 5.0 is way more memory efficient than the versions before and they even drastically lowered the default heap sizes[3].
- If you still have a custom heap size in your `dexOptions` set: that's not recommended anymore[4].
[1]: https://developer.android.com/studio/intro/studio-config https://developer.android.com/studio/intro/studio-config
[2]: https://discuss.kotlinlang.org/t/solved-disable-kotlin-compiler-process-keepalive/2622 https://discuss.kotlinlang.org/t/solved-disable-kotlin-compi...
[3]: https://github.com/gradle/gradle/issues/6216 https://github.com/gradle/gradle/issues/6216
[4]: https://stackoverflow.com/a/37230589/4779904 https://stackoverflow.com/a/37230589/4779904