src/share/vm/memory/permGen.cpp

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "incls/_precompiled.incl"
  26 #include "incls/_permGen.cpp.incl"













  27 
  28 HeapWord* PermGen::request_expand_and_allocate(Generation* gen, size_t size,
  29                                                GCCause::Cause prev_cause) {
  30   if (gen->capacity() < _capacity_expansion_limit ||
  31       prev_cause != GCCause::_no_gc || UseG1GC) {  // last disjunct is a temporary hack for G1
  32     return gen->expand_and_allocate(size, false);
  33   }
  34   // We have reached the limit of capacity expansion where
  35   // we will not expand further until a GC is done; request denied.
  36   return NULL;
  37 }
  38 
  39 HeapWord* PermGen::mem_allocate_in_gen(size_t size, Generation* gen) {
  40   GCCause::Cause next_cause = GCCause::_permanent_generation_full;
  41   GCCause::Cause prev_cause = GCCause::_no_gc;
  42   unsigned int gc_count_before, full_gc_count_before;
  43   HeapWord* obj;
  44 
  45   for (;;) {
  46     {




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc_implementation/shared/cSpaceCounters.hpp"
  27 #include "gc_implementation/shared/vmGCOperations.hpp"
  28 #include "gc_interface/collectedHeap.inline.hpp"
  29 #include "memory/blockOffsetTable.inline.hpp"
  30 #include "memory/compactPermGen.hpp"
  31 #include "memory/gcLocker.hpp"
  32 #include "memory/gcLocker.inline.hpp"
  33 #include "memory/genCollectedHeap.hpp"
  34 #include "memory/generation.inline.hpp"
  35 #include "memory/permGen.hpp"
  36 #include "memory/universe.hpp"
  37 #include "oops/oop.inline.hpp"
  38 #include "runtime/java.hpp"
  39 #include "runtime/vmThread.hpp"
  40 
  41 HeapWord* PermGen::request_expand_and_allocate(Generation* gen, size_t size,
  42                                                GCCause::Cause prev_cause) {
  43   if (gen->capacity() < _capacity_expansion_limit ||
  44       prev_cause != GCCause::_no_gc || UseG1GC) {  // last disjunct is a temporary hack for G1
  45     return gen->expand_and_allocate(size, false);
  46   }
  47   // We have reached the limit of capacity expansion where
  48   // we will not expand further until a GC is done; request denied.
  49   return NULL;
  50 }
  51 
  52 HeapWord* PermGen::mem_allocate_in_gen(size_t size, Generation* gen) {
  53   GCCause::Cause next_cause = GCCause::_permanent_generation_full;
  54   GCCause::Cause prev_cause = GCCause::_no_gc;
  55   unsigned int gc_count_before, full_gc_count_before;
  56   HeapWord* obj;
  57 
  58   for (;;) {
  59     {