As far as I know, for space in old generation of JVM, it could be utilized for two purposes,
- used for objects promoted from young generation to old generation?
- used for new object allocation in special use cases (https://stackoverflow.com/questions/9053144/will-i-encounter-java-lang-outofmemoryerror-even-with-no-lack-of-memory)
My questions are,
- Are there any other use cases to which will utilize space in old generation?
- I think there is a memory copy involved to copy objects from young generation to old generation, is it a deep copy or a shallow copy?
thanks in advance,
Lin
Let me answer 2. It is definitely not a deep copy: the GC handles objects as distinct memory blocks and deep copying really only means copying many distinct objects that are connected into an object graph. Also, you’d be better served by imagining a move, not a copy; copying is in fact just an “implementation detail” and the desired effect is relocating.