src/share/vm/services/memoryService.cpp

Print this page
rev 4210 : 8000754: NPG: Implement a MemoryPool MXBean for Metaspace

*** 61,70 **** --- 61,72 ---- new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryManager*>(init_managers_list_size, true); GCMemoryManager* MemoryService::_minor_gc_manager = NULL; GCMemoryManager* MemoryService::_major_gc_manager = NULL; MemoryPool* MemoryService::_code_heap_pool = NULL; + MemoryPool* MemoryService::_metaspace_pool = NULL; + MemoryPool* MemoryService::_class_metaspace_pool = NULL; class GcThreadCountClosure: public ThreadClosure { private: int _count; public:
*** 396,405 **** --- 398,420 ---- _pools_list->append(_code_heap_pool); _managers_list->append(mgr); } + void MemoryService::add_metaspace_memory_pools() { + _metaspace_pool = new MetaspacePool(); + _class_metaspace_pool = new ClassMetaspacePool(); + + MemoryManager* mgr = MemoryManager::get_metaspace_memory_manager(); + mgr->add_pool(_metaspace_pool); + mgr->add_pool(_class_metaspace_pool); + + _pools_list->append(_metaspace_pool); + _pools_list->append(_class_metaspace_pool); + _managers_list->append(mgr); + } + MemoryManager* MemoryService::get_memory_manager(instanceHandle mh) { for (int i = 0; i < _managers_list->length(); i++) { MemoryManager* mgr = _managers_list->at(i); if (mgr->is_manager(mh)) { return mgr;