< prev index next >

src/share/vm/memory/metaspace.hpp

Print this page


   1 /*
   2  * Copyright (c) 2011, 2018, 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  *


 399   // a GC is induced and the value is increased. Size is in bytes.
 400   static volatile intptr_t _capacity_until_GC;
 401 
 402   // For a CMS collection, signal that a concurrent collection should
 403   // be started.
 404   static bool _should_concurrent_collect;
 405 
 406   static uint _shrink_factor;
 407 
 408   static size_t shrink_factor() { return _shrink_factor; }
 409   void set_shrink_factor(uint v) { _shrink_factor = v; }
 410 
 411  public:
 412 
 413   static void initialize();
 414   static void post_initialize();
 415 
 416   static size_t capacity_until_GC();
 417   static bool inc_capacity_until_GC(size_t v,
 418                                     size_t* new_cap_until_GC = NULL,
 419                                     size_t* old_cap_until_GC = NULL);

 420   static size_t dec_capacity_until_GC(size_t v);
 421 
 422   static bool should_concurrent_collect() { return _should_concurrent_collect; }
 423   static void set_should_concurrent_collect(bool v) {
 424     _should_concurrent_collect = v;
 425   }
 426 
 427   // The amount to increase the high-water-mark (_capacity_until_GC)
 428   static size_t delta_capacity_until_GC(size_t bytes);
 429 
 430   // Tells if we have can expand metaspace without hitting set limits.
 431   static bool can_expand(size_t words, bool is_class);
 432 
 433   // Returns amount that we can expand without hitting a GC,
 434   // measured in words.
 435   static size_t allowed_expansion();
 436 
 437   // Calculate the new high-water mark at which to induce
 438   // a GC.
 439   static void compute_new_size();
   1 /*
   2  * Copyright (c) 2011, 2019, 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  *


 399   // a GC is induced and the value is increased. Size is in bytes.
 400   static volatile intptr_t _capacity_until_GC;
 401 
 402   // For a CMS collection, signal that a concurrent collection should
 403   // be started.
 404   static bool _should_concurrent_collect;
 405 
 406   static uint _shrink_factor;
 407 
 408   static size_t shrink_factor() { return _shrink_factor; }
 409   void set_shrink_factor(uint v) { _shrink_factor = v; }
 410 
 411  public:
 412 
 413   static void initialize();
 414   static void post_initialize();
 415 
 416   static size_t capacity_until_GC();
 417   static bool inc_capacity_until_GC(size_t v,
 418                                     size_t* new_cap_until_GC = NULL,
 419                                     size_t* old_cap_until_GC = NULL,
 420                                     bool* can_retry = NULL);
 421   static size_t dec_capacity_until_GC(size_t v);
 422 
 423   static bool should_concurrent_collect() { return _should_concurrent_collect; }
 424   static void set_should_concurrent_collect(bool v) {
 425     _should_concurrent_collect = v;
 426   }
 427 
 428   // The amount to increase the high-water-mark (_capacity_until_GC)
 429   static size_t delta_capacity_until_GC(size_t bytes);
 430 
 431   // Tells if we have can expand metaspace without hitting set limits.
 432   static bool can_expand(size_t words, bool is_class);
 433 
 434   // Returns amount that we can expand without hitting a GC,
 435   // measured in words.
 436   static size_t allowed_expansion();
 437 
 438   // Calculate the new high-water mark at which to induce
 439   // a GC.
 440   static void compute_new_size();
< prev index next >