Does Java program maximize memory impact on GC?

Does the -Xmx argument add a garbage collector to act differently or less often when starting a Java program?

+3
source share
5 answers

Yes, most Java garbage collectors work only as needed, and not on a schedule, regardless of whether they are needed or not. Thus, in general, more memory causes less frequent, longer garbage collections.

Have garbage collectors to generate settings for managing memory allocation between young and generational. Having established them, use a smaller proportion of total memory for the younger generation; the absolute size of the younger generation may be the same as the total heap size. Then you will not see changes in the frequency or duration of garbage collection, but you will have more options for long-lived objects for applications such as caching.

+9
source

The general answer is that garbage will be collected less frequently, but GC pauses will tend to be longer.

It is assumed that you already have more memory for the virtual machine than the size of the working set; otherwise you could spend a lot of time collecting garbage.

GC , Java, -Xms XXX. Java ( 5) . , -Xmx, - , .

, "" , , . , , . , , GC ( ). , , GC , .

, -Xmx (google java gc), , .

+4

, , . GC .

+2

, , , , , . , () GC , , . , . , , , , 1-1.

+1

. -Xmx , , . , gc . ( ) gc, , , -Xmx. -Xmx ( ) , , ( , ). ​​

, , ( gc), , -Mx .

-Xms GC. .

+1
source

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


All Articles