Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

How to change intellij vm options?

4 Answer(s) Available
Answer # 1 #
  • From the main menu, select Help | Find Action or press Ctrl+Shift+A .
  • Find and select the Choose Boot Java Runtime for the IDE action.
  • Select the new desired runtime and click OK.
  • Wait for IntelliJ IDEA to restart with the new runtime.
[4]
Edit
Query
Report
Chayse Sugiyama
Corsetier
Answer # 2 #

Intellij is run on the Java Virtual Machine (VM). The VM has many options/flags that can be used to tune its performance which, by extension, is IntelliJ's performance. This guide can help you get more performance out of your Jetbrains IDE or help you fix problems occuring due to the VMs default configuration. I wrote this guide from the perspective of a person curious about what all these options mean but has no idea what they do.

Don't care about the nitty gritty? Just want to copy and paste a slew of options? Look no further!

This should be a good lowest common denominator set of settings to help increase performance in Intellij.

Replace brackets with values so:

becomes

Note: To tune -Xmx for your project pay attention to the Memory Indicator.

The easiest way to edit these options for your Jetbrains IDE is to use the methods described in this article:

If that method is unavailabe the articles lists out manual ways to edit those files. Read it carefully!

Intellij is run on the Java Virtual Machine (VM). The heap is the memory (in RAM) that is allocated to the java virtual machine. So the heap size is total amount of memory that Intellij can use to operate.

-Xmx[memoryVal] - Specifies the maximum memory allocation of the heap for the VM. This is the maximum amount of memory Intellij can use.

-Xms[memoryVal] - Specifies the initial memory allocation of the heap for the VM. This will be the amount of memory Intellij starts with.

The garbage collector (GC) is a program in the VM that removes unused objects/resources and frees up space on the heap.

From the garbage collector's perspective there are two main sections, called generations, inside the heap:

Garbage collection is done on both generations, but each has different consequences.

Controlling the size of the young generation is an important tuning tool:

So choosing the right size depends on how you use Intellij. If you are constantly opening new files and jumping around projects you may want a larger young generation so that objects aren't being moved to the old generation quickly. If you are mostly static in your usage (staying in one area of a project or working on small scopes) a smaller young generation may be better for you as you won't be pushing new objects into the heap as often.

There are two ways to manage the young generation:

-XX:NewRatio=[ratio] - Specifies the young generation size in relation to the size of the old generation.

-Xmn[memoryVal] - Specifies the memory allocated to the young generation.

(IMO) There are two main GC approaches that can be used.

Note: If your heap is larger than 4GB it is recommended to use G1

This option uses mutliple threads to attempt to do GC in the background as to avoid application stopping. If you experience Intellij becoming jerky/unresponsive during heavy usage this may alleviate those problem.

Introduced in JDK 7 Update 4 G1 is similar to CMS but is built to support large heaps (4GB and larger). It breaks up the generations into smaller regions and keeps tracks of regions that produce more garbage. This is supposed to prevent large "stop the world" GC events that can occur in large heaps.

-XX:ParallelGCThreads=[value] - Specifies the number of GC thread to use for parallel GC (ParNewGC)

-XX:SurvivorRatio=[ratio] - Specifies the size of survivor generations inside the young generation.

-XX:SoftRefLRUPolicyMSPerMB=[value] - Specifies the number of milliseceonds, per free MB in the heap, a soft reference should remain alive.

-Xss=[memoryValue] - Specifies the memory allocated to a new stack

-XX:PermSize=[memoryValue] and -XX:MaxPermSize=[memoryValue]

-server - In a nutshell it tells the JVM to spend more time on the optimization of the fragments of codes that are most often used (hotspots). It leads to better performance at the price of a higher overhead at startup.

-XX:ReservedCodeCacheSize=[memoryValue] - Used to store the native code generated for compiled methods..

-XX:+OmitStackTraceInFastThrow - This is a flag recommended by Jetbrain. A description of what this flag does can be found here.

-XX:+HeapDumpOnOutOfMemoryError - Will cause a dump of the heap when an OutOfMemoryError error occurs (as explained here).

-XX:MaxJavaStackTraceDepth=[integer] - This specifies how many entries a stack trace for a thrown error or exception can have before a StackOverflowError is thrown.

-ea - This option enables assertions.

-Dsun.io.useCanonCaches=[boolean] - Specifies whether canonical file paths are cached.

-XX:+AggressiveOpts - Turns on some peformance optimizations that are expected to be on by default in upcoming releases.

-Djava.net.preferIPv4Stack=[boolean] - Specifies whether Intellij should prefer using IPv4 connections.

[3]
Edit
Query
Report
yyesmr Pounikar
MACHINE SNELLER
Answer # 3 #

In this chapter, we will get more familiar with IntelliJ IDEA. To discuss the advantages and functionality of any tool, one must be familiar with that tool and IntelliJ is no exception to that.

This chapter gives you an overview of IntelliJ. The chapter begins with a discussion about IDE’s visual elements, configuration settings and finally ends by discussing JVM and platform properties.

One of the important things about IDE is its visual elements. Identifying and understanding the visual elements enables to you do action in a quicker and easier manner. The following screenshot and the labels on it show the main interface of IntelliJ.

At the bottom of the main window, there is a status bar, which shows some additional attributes about the file - like its format and the encoding type. It also provides option to toggle the read-only attribute of the current file. You can also manage inspection level from here.

Plug-ins help to extend functionality of IntelliJ. It provides a large number of plug-ins ranging from databases, version controlling, profiling and this list goes on.

Follow these steps to manage plug-ins −

To perform other actions on plug-ins like uninstalling, updating and sorting, right-click on any plug-in. It will show a dropdown menu from which you can select one of the actions.

This section provides a few important tips to manage settings. It enables you to import, export and share IntelliJ settings.

It allows exporting the current settings as a jar file.

It allows importing the settings stored in the jar file.

IntelliJ IDEA allows you to share your IDE settings between different instances. This is particularly useful when you want to apply the same settings within a team or organization. The prerequisite for this is to enable the Settings Repository plug-in. It is installed and enabled by default.

To ensure its status −

We can store the current setting on GitHub/Bitbucket and apply them on other instances. To store the current setting −

We can configure the JVM options by navigating to the Help → Edit Custom VM Options menu. Following are a few important JVM options we can set.

[0]
Edit
Query
Report
Leonidas Briley
Pharmacist
Answer # 4 #

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

[0]
Edit
Query
Report
Stephen Roach
Nursing Management