I see the the PS survivor space is almost full (98 %) most of the time for my application. I don't know what is PS survivor space . Is this normal ? What should be done in such scenarios ?
1 Answers
First, see e.g. here : What is a survivor space?
Usually, there are 2 survivor spaces in the YoungGeneration part of the heap (e.g. for the Hostpot VM ). They are there to allow objects to mature before promoting them to the Old Generation. Because its more expensive to cleanup the old generation.
Collect some statistics to see if the survivor spaces are really full most of the time. You should see that one is always empty while the other one is being populated. See e.g. this question for collecting GC stats.
Once you have the data, look for:
survivor space overflow - this occurs when the survivor space is too small to allow the objects to mature between YoungHeap collections and the objects are overflowing to the OldGeneration without having time to mature (and die before being promoted).
also, monitor tenuring distribution with
-XX:+PrintTenuringDistribution
. To see how fast are the objects maturing.
UPDATE: Read the Hotspot Memory Management Whitepaper and see the section Serial Collector, there is a nice explanations of the Survivor spaces:
Note: If the To space becomes full, the live objects from Eden or From that have not been copied to it are tenured, regardless of how many young generation collections they have survived. Any objects remaining in Eden or the From space after live objects have been copied are, by definition, not live, and they do not need to be examined.
-
1Hi Ales , Thanks for your reply . I got a brief idea after reading your post . The survivor space is not full its almost full (98%) How to collect statistic ? will a full survivor space lead to system crash ? what happens when survivor space is full ? – Mizan Jan 22 '13 at 05:29
-
3So this is a normal behavior as the objects get copied in Survivor space from eden space the Survivor space gets almost full , Right ? ... should i increase the survivor space ratio ? – Mizan Jan 22 '13 at 07:00