6539517: CR 6186200 should be extended to perm gen allocation to prevent spurious OOM's from perm gen

Reviewed-by: ysr, jmasa
This commit is contained in:
Andrey Petrusenko 2008-04-01 15:13:47 +04:00
parent 6bfbc36dcd
commit 252a10cf1a
14 changed files with 165 additions and 80 deletions

View file

@ -144,3 +144,18 @@ void VM_GenCollectFull::doit() {
gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level);
notify_gc_end();
}
void VM_GenCollectForPermanentAllocation::doit() {
JvmtiGCForAllocationMarker jgcm;
notify_gc_begin(true);
GenCollectedHeap* gch = GenCollectedHeap::heap();
GCCauseSetter gccs(gch, _gc_cause);
gch->do_full_collection(gch->must_clear_all_soft_refs(),
gch->n_gens() - 1);
_res = gch->perm_gen()->allocate(_size, false);
assert(gch->is_in_reserved_or_null(_res), "result not in heap");
if (_res == NULL && GC_locker::is_active_and_needs_gc()) {
set_gc_locked();
}
notify_gc_end();
}

View file

@ -43,6 +43,7 @@
// is specified; and also the attach "inspectheap" operation
//
// VM_GenCollectForAllocation
// VM_GenCollectForPermanentAllocation
// VM_ParallelGCFailedAllocation
// VM_ParallelGCFailedPermanentAllocation
// - this operation is invoked when allocation is failed;
@ -166,3 +167,23 @@ class VM_GenCollectFull: public VM_GC_Operation {
virtual VMOp_Type type() const { return VMOp_GenCollectFull; }
virtual void doit();
};
class VM_GenCollectForPermanentAllocation: public VM_GC_Operation {
private:
HeapWord* _res;
size_t _size; // size of object to be allocated
public:
VM_GenCollectForPermanentAllocation(size_t size,
unsigned int gc_count_before,
unsigned int full_gc_count_before,
GCCause::Cause gc_cause)
: VM_GC_Operation(gc_count_before, full_gc_count_before, true),
_size(size) {
_res = NULL;
_gc_cause = gc_cause;
}
~VM_GenCollectForPermanentAllocation() {}
virtual VMOp_Type type() const { return VMOp_GenCollectForPermanentAllocation; }
virtual void doit();
HeapWord* result() const { return _res; }
};