< prev index next >

src/hotspot/share/services/memoryManager.cpp

Print this page

126       // Get the address of the object we created via call_special.
127       mgr_obj = mgr();
128 
129       // Use store barrier to make sure the memory accesses associated
130       // with creating the management object are visible before publishing
131       // its address.  The unlock will publish the store to _memory_mgr_obj
132       // because it does a release first.
133       OrderAccess::release_store(&_memory_mgr_obj, mgr_obj);
134     }
135   }
136 
137   return mgr_obj;
138 }
139 
140 void MemoryManager::oops_do(OopClosure* f) {
141   f->do_oop((oop*) &_memory_mgr_obj);
142 }
143 
144 GCStatInfo::GCStatInfo(int num_pools) {
145   // initialize the arrays for memory usage
146   _before_gc_usage_array = (MemoryUsage*) NEW_C_HEAP_ARRAY(MemoryUsage, num_pools, mtInternal);
147   _after_gc_usage_array  = (MemoryUsage*) NEW_C_HEAP_ARRAY(MemoryUsage, num_pools, mtInternal);
148   _usage_array_size = num_pools;
149   clear();
150 }
151 
152 GCStatInfo::~GCStatInfo() {
153   FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array);
154   FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array);
155 }
156 
157 void GCStatInfo::set_gc_usage(int pool_index, MemoryUsage usage, bool before_gc) {
158   MemoryUsage* gc_usage_array;
159   if (before_gc) {
160     gc_usage_array = _before_gc_usage_array;
161   } else {
162     gc_usage_array = _after_gc_usage_array;
163   }
164   gc_usage_array[pool_index] = usage;
165 }
166 
167 void GCStatInfo::clear() {

126       // Get the address of the object we created via call_special.
127       mgr_obj = mgr();
128 
129       // Use store barrier to make sure the memory accesses associated
130       // with creating the management object are visible before publishing
131       // its address.  The unlock will publish the store to _memory_mgr_obj
132       // because it does a release first.
133       OrderAccess::release_store(&_memory_mgr_obj, mgr_obj);
134     }
135   }
136 
137   return mgr_obj;
138 }
139 
140 void MemoryManager::oops_do(OopClosure* f) {
141   f->do_oop((oop*) &_memory_mgr_obj);
142 }
143 
144 GCStatInfo::GCStatInfo(int num_pools) {
145   // initialize the arrays for memory usage
146   _before_gc_usage_array = NEW_C_HEAP_ARRAY(MemoryUsage, num_pools, mtInternal);
147   _after_gc_usage_array  = NEW_C_HEAP_ARRAY(MemoryUsage, num_pools, mtInternal);
148   _usage_array_size = num_pools;
149   clear();
150 }
151 
152 GCStatInfo::~GCStatInfo() {
153   FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array);
154   FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array);
155 }
156 
157 void GCStatInfo::set_gc_usage(int pool_index, MemoryUsage usage, bool before_gc) {
158   MemoryUsage* gc_usage_array;
159   if (before_gc) {
160     gc_usage_array = _before_gc_usage_array;
161   } else {
162     gc_usage_array = _after_gc_usage_array;
163   }
164   gc_usage_array[pool_index] = usage;
165 }
166 
167 void GCStatInfo::clear() {
< prev index next >