hotspot source code - memory types and generation gc

vm/memory/allocation.hpp135行,关于 JVM 内存使用类型的定义,源码如下:

135136137138139140141142143144145146147148149150151152153154155156157158159160
/* * Memory types */enum MemoryType {  // Memory type by sub systems. It occupies lower byte.  mtJavaHeap          = 0x00,  // Java heap  mtClass             = 0x01,  // memory class for Java classes  mtThread            = 0x02,  // memory for thread objects  mtThreadStack       = 0x03,  mtCode              = 0x04,  // memory for generated code  mtGC                = 0x05,  // memory for GC  mtCompiler          = 0x06,  // memory for compiler  mtInternal          = 0x07,  // memory used by VM, but does not belong to                                 // any of above categories, and not used for                                 // native memory tracking  mtOther             = 0x08,  // memory not used by VM  mtSymbol            = 0x09,  // symbol  mtNMT               = 0x0A,  // memory used by native memory tracking  mtClassShared       = 0x0B,  // class data sharing  mtChunk             = 0x0C,  // chunk that holds content of arenas  mtTest              = 0x0D,  // Test type for verifying NMT  mtTracing           = 0x0E,  // memory used for Tracing  mtNone              = 0x0F,  // undefined  mt_number_of_types  = 0x10   // number of memory types (mtDontTrack                                 // is not included as validate type)};

vm/memory/generation.hpp38行,关于 JVM 支持的 GC 分代组合配置,源码如下:

38394041424344454647484950515253545556575859606162
// A Generation models a heap area for similarly-aged objects.// It will contain one ore more spaces holding the actual objects.//// The Generation class hierarchy://// Generation                      - abstract base class// - DefNewGeneration              - allocation area (copy collected)//   - ParNewGeneration            - a DefNewGeneration that is collected by//                                   several threads// - CardGeneration                 - abstract class adding offset array behavior//   - OneContigSpaceCardGeneration - abstract class holding a single//                                    contiguous space with card marking//     - TenuredGeneration         - tenured (old object) space (markSweepCompact)//   - ConcurrentMarkSweepGeneration - Mostly Concurrent Mark Sweep Generation//                                       (Detlefs-Printezis refinement of//                                       Boehm-Demers-Schenker)//// The system configurations currently allowed are:////   DefNewGeneration + TenuredGeneration//   DefNewGeneration + ConcurrentMarkSweepGeneration////   ParNewGeneration + TenuredGeneration//   ParNewGeneration + ConcurrentMarkSweepGeneration//

vm/memory/generation.hpp132行,关于 GC 分代类型名称,源码如下:

132133134135136137138139140141
// The set of possible generation kinds.enum Name {  ASParNew,  ASConcurrentMarkSweep,  DefNew,  ParNew,  MarkSweepCompact,  ConcurrentMarkSweep,  Other};

References

  1. vm/memory/allocation.hpp
  2. vm/memory/generation.hpp
  3. vm/memory/generation.hpp