When disabling garbage collectors in Java

I recently heard Kirk Pepperdin talk about changing garbage collectors for better performance - but what exactly does this mean and what makes the garbage collector better or different than the other?

+3
source share
3 answers

You ask two questions:

What does changing garbage collectors in Java mean for better performance?

This is a huge topic and, like some other respondents, I highly recommend you read it. I recommend Java SE 6 HotSpot [tm] Configuring a virtual machine for garbage collection from Sun. The information below mainly comes from there. The article "turbo-charge" java recommended in another answer is older.

In short, one of the many options we have when starting the JVM is to select a garbage collector, of which there are currently three:

  • Serial collector (selected with the -XX: + UseSerialGC option) - a single thread is used to work with the collection, and everyone waits for this to happen.
  • Parallel collector (selected with the -XX: + UseParallelGC option) - this makes small collections (of the younger generation) in parallel, but waits for everything during the main collections.
  • ( -XX: + UseConcMarkSweepGC) - .

?

. " " - , .

-, , , , , , , , .

: 1) ? 2) " " " "? , , , , , , ?

, :

  • Multi - , , Concurrent ( )
  • Multi -, , Parallel ( )
  • - ( 100 ) , , Serial
  • Single -, , Serial
  • Single - , , Concurrent ( )

, VM , , , , .

+6

, . , . , CMS, mutiple pass . , , , , , " " GC.

Edit

. , , - CMS. , ;) G1.

+2

, , Java ( " MyObject" , , ) .

- , , "" , , . Java. , , .

. , , , , - . .

Java , ( ) . , , -, .

+1

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


All Articles