The memory indicator shows: Max heap size: 1248M Allocated:986 I have 4gb ram on my syatem.Is there anything I can increase here so that ide becomes a bit faster? I don't use emulator.
-
duplicate https://stackoverflow.com/questions/18723755/android-studio-how-to-increase-allocated-heap-size – Style-7 Oct 17 '20 at 11:05
-
@Style-7 Perhaps it is not a duplicate. The machine in this question has much lower specifications than the linked question. Some alternative solutions would seem to be useful in this case. – Michael Lundie Oct 18 '20 at 00:44
1 Answers
There are numerous things which will influence the speed of the IDE, and a few things that you can do to speed it up. In your case having less than the recommended RAM (5GB is officially recommended for 64bit systems), you might find optimising your system gives far more of a performance boost than optimising the IDE itself.
First up, if you are running a Windows OS, the modern versions of which use a lot of RAM (in context of a 4GB system) it might be a good idea to look at installing a light-weight linux distro like Linux Mint. This will free up system resources and give Android Studio more to play with.
Secondly, it is likely your using a web browser along side Android Studio. Browsers, especially when you have multiple tabs open, use a lot of RAM. Use a lightweight browser and be mindful of tab use.
Thirdly, offline mode. One can run Android Studio in offline mode. This will cut some of it's functionality (including code hinting), but will give a performance boost. You can find docs about that here. Enable offline mode with the followings steps (quoted from the documentation):
- Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
- In the left pane, click Build, Execution, Deployment > Gradle.
- Check the Offline work checkbox.
- Click Apply or OK.
Since RAM allocation was specifically mentioned, we can take a look at that also.
As mentioned earlier, running windows uses a lot of RAM, so increasing heap memory allocation will unlikely glean any performance gains. It is quite likely you will end up with worse performance, since the JAVA heap will begin eating into RAM required for other system processes.
Also, for each instance of Android Studio, a new java heap will be created, further eating into limited resources (it would best not running multiple instances with 4Gb of memory).
Having said all this, there are some simple ways to edit RAM allocation. As always, be sure to have a look at these docs and these.
For per-project JVM memory allocation, you can add/edit this line in your gradle.properties:
org.gradle.jvmargs=-Xmx1536m
You can also permenantly edit Java heap allocation by doing the following (taken from the android studio docs):
- Click File > Settings from the menu bar (or Android Studio > Preferences on macOS).
- Click Appearance & Behavior > System Settings > Memory Settings.
- Adjust the heap sizes to match your desired amounts.
- Click Apply.

- 166
- 6
-
-
@user As mentioned above in the answer, increasing your heap allocation is likely to reduce performance (if you are using a Windows based machine). You will likely experience your computer being unresponsive for seconds at a time while it attempts to use hard disk memory as system memory. – Michael Lundie Oct 19 '20 at 00:50
-
My setting has always been at 2048 but Android Studio always uses more RAM than this – behelit Jul 05 '23 at 02:06
-
@behelit If you are referring to the "jvmargs" setting, this is only for the JVM (Java Virtual Machine). Android Studio will still be consuming a lot more memory than that. – Michael Lundie Jul 06 '23 at 05:35