356 if (PrintGCDetails && Verbose) {
357 gclog_or_tty->print_cr("ParallelScavengeHeap::mem_allocate: "
358 "return NULL because gc_overhead_limit_exceeded is set");
359 }
360 if (op.result() != NULL) {
361 CollectedHeap::fill_with_object(op.result(), size);
362 }
363 return NULL;
364 }
365
366 return op.result();
367 }
368 }
369
370 // The policy object will prevent us from looping forever. If the
371 // time spent in gc crosses a threshold, we will bail out.
372 loop_count++;
373 if ((result == NULL) && (QueuedAllocationWarningCount > 0) &&
374 (loop_count % QueuedAllocationWarningCount == 0)) {
375 warning("ParallelScavengeHeap::mem_allocate retries %d times \n\t"
376 " size=%d", loop_count, size);
377 }
378 }
379
380 return result;
381 }
382
383 // A "death march" is a series of ultra-slow allocations in which a full gc is
384 // done before each allocation, and after the full gc the allocation still
385 // cannot be satisfied from the young gen. This routine detects that condition;
386 // it should be called after a full gc has been done and the allocation
387 // attempted from the young gen. The parameter 'addr' should be the result of
388 // that young gen allocation attempt.
389 void
390 ParallelScavengeHeap::death_march_check(HeapWord* const addr, size_t size) {
391 if (addr != NULL) {
392 _death_march_count = 0; // death march has ended
393 } else if (_death_march_count == 0) {
394 if (should_alloc_in_eden(size)) {
395 _death_march_count = 1; // death march has started
396 }
|
356 if (PrintGCDetails && Verbose) {
357 gclog_or_tty->print_cr("ParallelScavengeHeap::mem_allocate: "
358 "return NULL because gc_overhead_limit_exceeded is set");
359 }
360 if (op.result() != NULL) {
361 CollectedHeap::fill_with_object(op.result(), size);
362 }
363 return NULL;
364 }
365
366 return op.result();
367 }
368 }
369
370 // The policy object will prevent us from looping forever. If the
371 // time spent in gc crosses a threshold, we will bail out.
372 loop_count++;
373 if ((result == NULL) && (QueuedAllocationWarningCount > 0) &&
374 (loop_count % QueuedAllocationWarningCount == 0)) {
375 warning("ParallelScavengeHeap::mem_allocate retries %d times \n\t"
376 " size=" SIZE_FORMAT, loop_count, size);
377 }
378 }
379
380 return result;
381 }
382
383 // A "death march" is a series of ultra-slow allocations in which a full gc is
384 // done before each allocation, and after the full gc the allocation still
385 // cannot be satisfied from the young gen. This routine detects that condition;
386 // it should be called after a full gc has been done and the allocation
387 // attempted from the young gen. The parameter 'addr' should be the result of
388 // that young gen allocation attempt.
389 void
390 ParallelScavengeHeap::death_march_check(HeapWord* const addr, size_t size) {
391 if (addr != NULL) {
392 _death_march_count = 0; // death march has ended
393 } else if (_death_march_count == 0) {
394 if (should_alloc_in_eden(size)) {
395 _death_march_count = 1; // death march has started
396 }
|