2
votes

Below are the statments i found at http://www.springsource.com/files/uploads/all/pdf_files/news_event/Inside_the_JVM.pdf while going thru memory management

Statement1:-

All new objects are created in young generation Only moved to Old Gen if they survive one or more minor GC

Question1 :- Did not get what minor GC mean here?

Statement2:-

Major collections occur when the tenured space fills up

Question2:- Did not get what major collection mean here?

As per my understanding,
all new objects are created in young generation then GC runs then deallocate the memory for the objects whose reference is not reachable and transfer the all other objects to old generation.

Question3 : Now when does the JVM decide to run GC on old and young generation? Does it run when young and old generation fills up the some specified space of each generation?

Edit Looks like its youn generation is minor collection because its size is much less than old generation which is a major collection.This a guess. Not sure?

2

2 Answers

3
votes

1) A minor collection is a copy of object from or between the young spaces.

2) A major collection is a tidy of the old generation.

The minor collection is usually quicker than a major collection which may explain the names.

3) When copied object from the young generation fill the old gen, a full collection occurs. (The concurrent collector can trigger a major collection when it decides the old generation is a bit full)

2
votes

The explanation is pretty long and the best answer would be to go through http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html which clearly explains all the concepts in detail.