75 volatile instanceOop _memory_pool_obj;
76
77 void add_manager(MemoryManager* mgr);
78
79 public:
80 MemoryPool(const char* name,
81 PoolType type,
82 size_t init_size,
83 size_t max_size,
84 bool support_usage_threshold,
85 bool support_gc_threshold);
86
87 const char* name() { return _name; }
88 bool is_heap() { return _type == Heap; }
89 bool is_non_heap() { return _type == NonHeap; }
90 size_t initial_size() const { return _initial_size; }
91 int num_memory_managers() const { return _num_managers; }
92 // max size could be changed
93 virtual size_t max_size() const { return _max_size; }
94
95 bool is_pool(instanceHandle pool) { return (pool() == _memory_pool_obj); }
96
97 bool available_for_allocation() { return _available_for_allocation; }
98 bool set_available_for_allocation(bool value) {
99 bool prev = _available_for_allocation;
100 _available_for_allocation = value;
101 return prev;
102 }
103
104 MemoryManager* get_memory_manager(int index) {
105 assert(index >= 0 && index < _num_managers, "Invalid index");
106 return _managers[index];
107 }
108
109 // Records current memory usage if it's a peak usage
110 void record_peak_memory_usage();
111
112 MemoryUsage get_peak_memory_usage() {
113 // check current memory usage first and then return peak usage
114 record_peak_memory_usage();
115 return _peak_usage;
|
75 volatile instanceOop _memory_pool_obj;
76
77 void add_manager(MemoryManager* mgr);
78
79 public:
80 MemoryPool(const char* name,
81 PoolType type,
82 size_t init_size,
83 size_t max_size,
84 bool support_usage_threshold,
85 bool support_gc_threshold);
86
87 const char* name() { return _name; }
88 bool is_heap() { return _type == Heap; }
89 bool is_non_heap() { return _type == NonHeap; }
90 size_t initial_size() const { return _initial_size; }
91 int num_memory_managers() const { return _num_managers; }
92 // max size could be changed
93 virtual size_t max_size() const { return _max_size; }
94
95 bool is_pool(instanceHandle pool) { return oopDesc::equals(pool(), _memory_pool_obj); }
96
97 bool available_for_allocation() { return _available_for_allocation; }
98 bool set_available_for_allocation(bool value) {
99 bool prev = _available_for_allocation;
100 _available_for_allocation = value;
101 return prev;
102 }
103
104 MemoryManager* get_memory_manager(int index) {
105 assert(index >= 0 && index < _num_managers, "Invalid index");
106 return _managers[index];
107 }
108
109 // Records current memory usage if it's a peak usage
110 void record_peak_memory_usage();
111
112 MemoryUsage get_peak_memory_usage() {
113 // check current memory usage first and then return peak usage
114 record_peak_memory_usage();
115 return _peak_usage;
|