Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set memory for the VM in IntelliJ? Do I have to set Tomcat memory options separately?

I'm doing some benchmarking and I want to know how to set memory for both IntelliJ and Tomcat.

In the bottom right corner I see 98M of 147M in IntelliJ, what is that for?

How do I know if I have allocated tomcat enough memory?

like image 917
Blankman Avatar asked Dec 17 '11 03:12

Blankman


People also ask

What should I put in VM options IntelliJ?

Configure JVM optionsFrom the main menu, select Help | Edit Custom VM Options. If you do not have any project open, on the Welcome screen, click Configure and then Edit Custom VM Options. If you cannot start IntelliJ IDEA, manually copy the default file with JVM options to the IntelliJ IDEA configuration directory.

How do I allocate more memory to IntelliJ?

From the main menu, select Help | Change Memory Settings. Set the necessary amount of memory that you want to allocate and click Save and Restart.

How much memory should I allocate to IntelliJ?

IntelliJ IDEA memory usage Follow IntelliJ itself reports that it is using a little more than 1GB of heap but the OS reports that it is using anywhere from 3.5 to 4.5 GB.


2 Answers

You can simply change three lines in your VM Options

Help->Edit Custom VM Options. Replace the first three lines by :

-Xms1024m
-Xmx4096m
-XX:ReservedCodeCacheSize=1024m

It's good numbers if you have 8-12Go in your machine.

like image 152
Nicolas Zozol Avatar answered Oct 07 '22 05:10

Nicolas Zozol


Set memory options for IntelliJ itself in its VM options file.

  • OS X: Contents/info.plist (embedded in the app's directory)
  • Linux: bin/idea.vmoptions
  • Windows: (install dir/)bin/idea.exe.vmoptions for example C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1.1\bin\idea.exe.vmoptions

As of IntelliJ 12, for OS X:

  • The file /Applications/IntelliJ IDEA.app/bin/idea.vmoptions should be copied to ~/Library/Preferences/IntelliJIdeaXX/idea.vmoptions

This is as per JetBrains' DOC-197 linked to by CrazyCoder.

The memory indicator shows used/max memory.

You know if you've allocated TC enough memory if it doesn't run out, and/or doesn't hiccup due to a large GC, and/or doesn't thrash swapping. Tomcat memory settings are configured in the Tomcat run configuration where it says "VM options".

like image 40
Dave Newton Avatar answered Oct 07 '22 03:10

Dave Newton