Java Major and Minor Garbage Collections -


i have been reading on garbage collection in java , q&a i'm confused types of garbage collection.

let's take throughput collector example. (aka parallel collector). docs uses multiple threads minor collections , single thread major collections (same serial collector).

now questions:

  1. what mean full gc: a) mean both minor , major collections done? or b) full gc == major collections? 1 it?
  2. if a), mean minor collection still done using multiple threads whereas major done using single?
  3. if b), mean both young & old generations cleared using single thread?

also, 4. full gc affect oldgeneration or younggeneration well?

thanks in advance.

let me explain.

let's take throughput collector example. (aka parallel collector). docs uses multiple threads minor collections , single thread major collections (same serial collector).

here's understand. default, on newer systems, jvm uses 2 different garbage collectors young , old generations. on my machine: have parallel new collector young generation , concurrent mark , sweep collector older generation.

minor collection triggered when jvm unable allocate space new object (remember: new objects allocated in young generation's eden area).

next question:

what mean full gc: a) mean both minor , major collections done? or b) full gc == major collections? 1 it?

and,

also, 4. full gc affect oldgeneration or younggeneration well?

it depends. jvm reports every major collection full gc. [try these flags java -verbose:gc -xx:+printgcdetails -xx:+printgctimestamp]. pedantic definition full gc runs minor first followed major (although order switched if older generation full in case freed first allow receive objects young generation).

ok, point. jvm considers major collection [in older (or perm) generation] full gc. below outputs program able write illustrate point. first line minor gc , second major (full) gc. can see happened in older generation (cms) , able reduce old generation 1082k 1034k.

  • 11.431: [gc 11.431: [parnew: 1152k->128k(1152k), 0.0009893 secs] 2111k->1210k(6464k), 0.0010182 secs] [times: user=0.00 sys=0.00, real=0.00 secs]
  • 17.882: [full gc (system) 17.882: [cms: 1082k->1034k(5312k), 0.0212614 secs] 2034k->1034k(6464k), [cms perm : 9426k->9410k(21248k)], 0.0213200 secs] [times: user=0.02 sys=0.00, real=0.02 secs]

next question:

if a), mean minor collection still done using multiple threads whereas major done using single?

yes. see beginning of answer. young , older generations served different collectors. young generation, can use 1 of following:

  • -xx:+useserialgc
  • -xx:+useparallelgc
  • -xx:+useparnewgc

for old generation, available choices are:

  • -xx:+useparalleloldgc
  • -xx:+useconcmarksweepgc

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -