< prev index next >

src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp

Print this page

214 
215 
216 size_t ParallelScavengeHeap::max_capacity() const {
217   size_t estimated = reserved_region().byte_size();
218   if (UseAdaptiveSizePolicy) {
219     estimated -= _size_policy->max_survivor_size(young_gen()->max_gen_size());
220   } else {
221     estimated -= young_gen()->to_space()->capacity_in_bytes();
222   }
223   return MAX2(estimated, capacity());
224 }
225 
226 bool ParallelScavengeHeap::is_in(const void* p) const {
227   return young_gen()->is_in(p) || old_gen()->is_in(p);
228 }
229 
230 bool ParallelScavengeHeap::is_in_reserved(const void* p) const {
231   return young_gen()->is_in_reserved(p) || old_gen()->is_in_reserved(p);
232 }
233 




234 // There are two levels of allocation policy here.
235 //
236 // When an allocation request fails, the requesting thread must invoke a VM
237 // operation, transfer control to the VM thread, and await the results of a
238 // garbage collection. That is quite expensive, and we should avoid doing it
239 // multiple times if possible.
240 //
241 // To accomplish this, we have a basic allocation policy, and also a
242 // failed allocation policy.
243 //
244 // The basic allocation policy controls how you allocate memory without
245 // attempting garbage collection. It is okay to grab locks and
246 // expand the heap, if that can be done without coming to a safepoint.
247 // It is likely that the basic allocation policy will not be very
248 // aggressive.
249 //
250 // The failed allocation policy is invoked from the VM thread after
251 // the basic allocation policy is unable to satisfy a mem_allocate
252 // request. This policy needs to cover the entire range of collection,
253 // heap expansion, and out-of-memory conditions. It should make every

214 
215 
216 size_t ParallelScavengeHeap::max_capacity() const {
217   size_t estimated = reserved_region().byte_size();
218   if (UseAdaptiveSizePolicy) {
219     estimated -= _size_policy->max_survivor_size(young_gen()->max_gen_size());
220   } else {
221     estimated -= young_gen()->to_space()->capacity_in_bytes();
222   }
223   return MAX2(estimated, capacity());
224 }
225 
226 bool ParallelScavengeHeap::is_in(const void* p) const {
227   return young_gen()->is_in(p) || old_gen()->is_in(p);
228 }
229 
230 bool ParallelScavengeHeap::is_in_reserved(const void* p) const {
231   return young_gen()->is_in_reserved(p) || old_gen()->is_in_reserved(p);
232 }
233 
234 bool ParallelScavengeHeap::requires_barriers(oop p) const {
235   return !is_in_young(p);
236 }
237 
238 // There are two levels of allocation policy here.
239 //
240 // When an allocation request fails, the requesting thread must invoke a VM
241 // operation, transfer control to the VM thread, and await the results of a
242 // garbage collection. That is quite expensive, and we should avoid doing it
243 // multiple times if possible.
244 //
245 // To accomplish this, we have a basic allocation policy, and also a
246 // failed allocation policy.
247 //
248 // The basic allocation policy controls how you allocate memory without
249 // attempting garbage collection. It is okay to grab locks and
250 // expand the heap, if that can be done without coming to a safepoint.
251 // It is likely that the basic allocation policy will not be very
252 // aggressive.
253 //
254 // The failed allocation policy is invoked from the VM thread after
255 // the basic allocation policy is unable to satisfy a mem_allocate
256 // request. This policy needs to cover the entire range of collection,
257 // heap expansion, and out-of-memory conditions. It should make every
< prev index next >