Eclipse Rollback Returns to System

I am using Eclipse 3.6 with the latest versions of Sun Java 6 on Linux (64 bit) with many large projects. In some special cases (such as SVN updates), Eclipse requires a bunch of up to 1 GB. But most of the time it only takes 350 MB. When I turn on the heap status bar, I see this most of the time:

350M from 878M

I run Eclipse with these settings: -Xms128m -Xmx1024m

Therefore, most of the time, many MBs are simply wasted and rarely used when memory usage reaches its maximum for a short time. I don't like this at all, and I want Eclipse to release the memory back into the system, so I can use it for other programs.

When Eclipse needs more memory, while there is not enough free RAM than Linux, you can change other running programs, I can live with it. I heard that there is an option -XX: MaxHeapFreeRatio. But I never figured out what values ​​I need to use to make it work. No value that I tried ever did did matter.

So, how can I tell Eclipse (or Java) to free an unused heap?

+3
source share
3 answers

Found a solution. I switched Java to using the G1 garbage collector, and now the HeapFreeRatio options are working as intended. Therefore, I use these options in eclipse.ini:

-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:MinHeapFreeRatio=5
-XX:MaxHeapFreeRatio=25

, Eclipse 1 300 , .

+11

Preferences -> General Show heap status. Eclipse. - :

alt text

, .

+2

Java - , , JVM. - , .

JVM - malloc(), brk(). Linux (Solaris ) , , , , , . , , , , - .

-Xms -Xmx JVM , Java, . Java , , JVM, .


:

, C ( JVM, Eclipse ) , malloc(3), OS . , malloc() free(), .

Unix , , . , brk(2) , , . . , malloc() , free() , , , . , malloc(), , free(), .

+1
source

Source: https://habr.com/ru/post/1766145/


All Articles