void MemoryService::add_g1PermGen_memory_pool(G1CollectedHeap* g1h, MemoryManager* mgr) { assert(mgr != NULL, "should have one manager"); CompactingPermGenGen* perm_gen = (CompactingPermGenGen*) g1h->perm_gen(); PermanentGenerationSpec* spec = perm_gen->spec(); size_t max_size = spec->max_size() - spec->read_only_size() - spec->read_write_size(); MemoryPool* pool = add_space(perm_gen->unshared_space(), "G1 Perm Gen", false, /* is_heap */ max_size, true /* support_usage_threshold */); mgr->add_pool(pool); // in case we support CDS in G1 if (UseSharedSpaces) { pool = add_space(perm_gen->ro_space(), "G1 Perm Gen [shared-ro]", false, /* is_heap */ spec->read_only_size(), true /* support_usage_threshold */); mgr->add_pool(pool); pool = add_space(perm_gen->rw_space(), "G1 Perm Gen [shared-rw]", false, /* is_heap */ spec->read_write_size(), true /* support_usage_threshold */); mgr->add_pool(pool); } }
void MemoryService::add_compact_perm_gen_memory_pool(CompactingPermGenGen* perm_gen, MemoryManager* mgr) { PermanentGenerationSpec* spec = perm_gen->spec(); size_t max_size = spec->max_size() - spec->read_only_size() - spec->read_write_size(); MemoryPool* pool = add_space(perm_gen->unshared_space(), "Perm Gen", false, /* is_heap */ max_size, true /* support_usage_threshold */); mgr->add_pool(pool); if (UseSharedSpaces) { pool = add_space(perm_gen->ro_space(), "Perm Gen [shared-ro]", false, /* is_heap */ spec->read_only_size(), true /* support_usage_threshold */); mgr->add_pool(pool); pool = add_space(perm_gen->rw_space(), "Perm Gen [shared-rw]", false, /* is_heap */ spec->read_write_size(), true /* support_usage_threshold */); mgr->add_pool(pool); } }