It is impossible to isolate directly in generation 2. All distributions occur in generation 0 and for large objects on the LOH.
However, data is usually not copied when objects are moved to a new generation. Instead, the starting points of the different heaps move. Objects may be moved due to heap compaction, but this is a completely different story.
If it is important to store objects in generation 2, you can reuse instances. That is, make some init method for the types and call it instead of creating new instances.
source
share