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

22,974

Solution 1

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".

Solution 2

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.

Solution 3

I d some problems to set the memory : So i m using this settings for my vm :

-Xms768m
-Xmx768m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=64m
-server
-XX:NewSize=128m
-XX:+UseParNewGC
-XX:ParallelGCThreads=8
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=60
Share:
22,974
Blankman
Author by

Blankman

... .. . blank

Updated on May 10, 2020

Comments

  • Blankman
    Blankman almost 4 years

    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?

  • Blankman
    Blankman over 12 years
    so when running apache bench, where should I be looking to see these #'s for tomcat? is there a profiler for tomcat?
  • Blankman
    Blankman over 12 years
    I'm on Mac (Lion), can't seem to find that file?
  • Dave Newton
    Dave Newton over 12 years
    @Blankman Under OS X it's in Contents/info.plist as one of the VMOptions.
  • wjl
    wjl almost 11 years
    This is not an answer. The question was what the memory statistics in the bottom-right actually mean, and how to tell if enough memory is allocated. Your VM options, while they may work great for you, do not explain what they actually mean or how you decided they were correct.
  • Mikeumus
    Mikeumus about 5 years
    IntelliJ 2018 on this date for me on Mac is at: /Applications/IntelliJ\ IDEA.app/Contents/bin/idea.vmoptions