< prev index next >

src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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  *


 852   // compute expansion delta needed for reaching desired free percentage
 853   if (free_percentage < desired_free_percentage) {
 854     size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
 855     assert(desired_capacity >= capacity(), "invalid expansion size");
 856     size_t expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes);
 857     if (PrintGCDetails && Verbose) {
 858       size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
 859       gclog_or_tty->print_cr("\nFrom compute_new_size: ");
 860       gclog_or_tty->print_cr("  Free fraction %f", free_percentage);
 861       gclog_or_tty->print_cr("  Desired free fraction %f",
 862         desired_free_percentage);
 863       gclog_or_tty->print_cr("  Maximum free fraction %f",
 864         maximum_free_percentage);
 865       gclog_or_tty->print_cr("  Capacity "SIZE_FORMAT, capacity()/1000);
 866       gclog_or_tty->print_cr("  Desired capacity "SIZE_FORMAT,
 867         desired_capacity/1000);
 868       int prev_level = level() - 1;
 869       if (prev_level >= 0) {
 870         size_t prev_size = 0;
 871         GenCollectedHeap* gch = GenCollectedHeap::heap();
 872         Generation* prev_gen = gch->_gens[prev_level];
 873         prev_size = prev_gen->capacity();
 874           gclog_or_tty->print_cr("  Younger gen size "SIZE_FORMAT,
 875                                  prev_size/1000);
 876       }
 877       gclog_or_tty->print_cr("  unsafe_max_alloc_nogc "SIZE_FORMAT,
 878         unsafe_max_alloc_nogc()/1000);
 879       gclog_or_tty->print_cr("  contiguous available "SIZE_FORMAT,
 880         contiguous_available()/1000);
 881       gclog_or_tty->print_cr("  Expand by "SIZE_FORMAT" (bytes)",
 882         expand_bytes);
 883     }
 884     // safe if expansion fails
 885     expand_for_gc_cause(expand_bytes, 0, CMSExpansionCause::_satisfy_free_ratio);
 886     if (PrintGCDetails && Verbose) {
 887       gclog_or_tty->print_cr("  Expanded free fraction %f",
 888         ((double) free()) / capacity());
 889     }
 890   } else {
 891     size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
 892     assert(desired_capacity <= capacity(), "invalid expansion size");


   1 /*
   2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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  *


 852   // compute expansion delta needed for reaching desired free percentage
 853   if (free_percentage < desired_free_percentage) {
 854     size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
 855     assert(desired_capacity >= capacity(), "invalid expansion size");
 856     size_t expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes);
 857     if (PrintGCDetails && Verbose) {
 858       size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
 859       gclog_or_tty->print_cr("\nFrom compute_new_size: ");
 860       gclog_or_tty->print_cr("  Free fraction %f", free_percentage);
 861       gclog_or_tty->print_cr("  Desired free fraction %f",
 862         desired_free_percentage);
 863       gclog_or_tty->print_cr("  Maximum free fraction %f",
 864         maximum_free_percentage);
 865       gclog_or_tty->print_cr("  Capacity "SIZE_FORMAT, capacity()/1000);
 866       gclog_or_tty->print_cr("  Desired capacity "SIZE_FORMAT,
 867         desired_capacity/1000);
 868       int prev_level = level() - 1;
 869       if (prev_level >= 0) {
 870         size_t prev_size = 0;
 871         GenCollectedHeap* gch = GenCollectedHeap::heap();
 872         Generation* prev_gen = gch->get_gen(prev_level);
 873         prev_size = prev_gen->capacity();
 874           gclog_or_tty->print_cr("  Younger gen size "SIZE_FORMAT,
 875                                  prev_size/1000);
 876       }
 877       gclog_or_tty->print_cr("  unsafe_max_alloc_nogc "SIZE_FORMAT,
 878         unsafe_max_alloc_nogc()/1000);
 879       gclog_or_tty->print_cr("  contiguous available "SIZE_FORMAT,
 880         contiguous_available()/1000);
 881       gclog_or_tty->print_cr("  Expand by "SIZE_FORMAT" (bytes)",
 882         expand_bytes);
 883     }
 884     // safe if expansion fails
 885     expand_for_gc_cause(expand_bytes, 0, CMSExpansionCause::_satisfy_free_ratio);
 886     if (PrintGCDetails && Verbose) {
 887       gclog_or_tty->print_cr("  Expanded free fraction %f",
 888         ((double) free()) / capacity());
 889     }
 890   } else {
 891     size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
 892     assert(desired_capacity <= capacity(), "invalid expansion size");


< prev index next >