IntelliJ | Relation Between Max. Heap Size (IDE Settings) and Build Process Shared Heap

已回答

I am new to java development and there are 2 memory based parameters I want to understand in the IDE.
1. Help > Change Memory Settings > Heap Size
As I understand this dictates the maximum memory the whole IDE as an application will take. Any and all indexes or projects I open simultaneously will take up space here. I assume the whole of 35GBs here will be allocated as soon as I open the application.

2. Settings > Build, Execution, Deployment > Compiler > Build Process > Shared Heap Size
I assume this is the memory reserved for any compilation process (java → class files) conversion will take. If i trigger tests to run in 2 project windows simultaneously, both will use this combined 20GBs. This memory will be on top of the original 35 and will be allocated on a need-basis until a threshold of 20 is hit.

My questions are:
1. Is my understanding of the memory allocation so far correct?
2. The memory comsumed for running the test file will be separate and dictated by the Xmx Xms flags I add to the run configuration?
3. Does the memory consumed by the build process de-allocate as soon as test starts running? 
4. Are there any other memory flags, settings or optimizations that will be good for a newbie to keep in mind?

Thanks for the help!

0

1. Help > Change Memory Settings > Heap Size
As I understand this dictates the maximum memory the whole IDE as an application will take. Any and all indexes or projects I open simultaneously will take up space here. I assume the whole of 35GBs here will be allocated as soon as I open the application.

Not exactly. the Change Memory Settings > Heap Size indeed controls how much memory can be allocated for the whole IDE process. Technically, it increases the -xmx value, so IDE cannot use more than 35G in your case. But it doesn't mean that the IDE process will take all 35G on startup. Initial heap size can be controlled using the -xms option which can be manually declared under `Help | Edit Custom VM Options` if needed

A bit more information can be found here https://www.jetbrains.com/help/idea/increasing-memory-heap.html and here https://stackoverflow.com/questions/14763079/what-are-the-xms-and-xmx-parameters-when-starting-jvm 

> Settings > Build, Execution, Deployment > Compiler > Build Process > Shared Heap Size
I assume this is the memory reserved for any compilation process (java → class files) conversion will take.

Right, IDE and build processes are two different independent JVM processes

But notice that building and running projects/tests are also different JVM processes. If you need to use custom memory settings for executing your projects, you can customize VM options per Run/Debug Configuration 

I'd recommend using JVM tools such as jps -lv during IDE launch , project build ,  project execution to better understand how these processes are being initialized

0

请先登录再写评论。