src/share/vm/memory/metaspace.hpp

Print this page
rev 6722 : 8049599: MetaspaceGC::_capacity_until_GC can overflow
Reviewed-by: jmasa, stefank


 387   // The current high-water-mark for inducing a GC.
 388   // When committed memory of all metaspaces reaches this value,
 389   // a GC is induced and the value is increased. Size is in bytes.
 390   static volatile intptr_t _capacity_until_GC;
 391 
 392   // For a CMS collection, signal that a concurrent collection should
 393   // be started.
 394   static bool _should_concurrent_collect;
 395 
 396   static uint _shrink_factor;
 397 
 398   static size_t shrink_factor() { return _shrink_factor; }
 399   void set_shrink_factor(uint v) { _shrink_factor = v; }
 400 
 401  public:
 402 
 403   static void initialize();
 404   static void post_initialize();
 405 
 406   static size_t capacity_until_GC();
 407   static size_t inc_capacity_until_GC(size_t v);


 408   static size_t dec_capacity_until_GC(size_t v);
 409 
 410   static bool should_concurrent_collect() { return _should_concurrent_collect; }
 411   static void set_should_concurrent_collect(bool v) {
 412     _should_concurrent_collect = v;
 413   }
 414 
 415   // The amount to increase the high-water-mark (_capacity_until_GC)
 416   static size_t delta_capacity_until_GC(size_t bytes);
 417 
 418   // Tells if we have can expand metaspace without hitting set limits.
 419   static bool can_expand(size_t words, bool is_class);
 420 
 421   // Returns amount that we can expand without hitting a GC,
 422   // measured in words.
 423   static size_t allowed_expansion();
 424 
 425   // Calculate the new high-water mark at which to induce
 426   // a GC.
 427   static void compute_new_size();


 387   // The current high-water-mark for inducing a GC.
 388   // When committed memory of all metaspaces reaches this value,
 389   // a GC is induced and the value is increased. Size is in bytes.
 390   static volatile intptr_t _capacity_until_GC;
 391 
 392   // For a CMS collection, signal that a concurrent collection should
 393   // be started.
 394   static bool _should_concurrent_collect;
 395 
 396   static uint _shrink_factor;
 397 
 398   static size_t shrink_factor() { return _shrink_factor; }
 399   void set_shrink_factor(uint v) { _shrink_factor = v; }
 400 
 401  public:
 402 
 403   static void initialize();
 404   static void post_initialize();
 405 
 406   static size_t capacity_until_GC();
 407   static bool inc_capacity_until_GC(size_t v,
 408                                     size_t* new_cap_until_GC = NULL,
 409                                     size_t* old_cap_until_GC = NULL);
 410   static size_t dec_capacity_until_GC(size_t v);
 411 
 412   static bool should_concurrent_collect() { return _should_concurrent_collect; }
 413   static void set_should_concurrent_collect(bool v) {
 414     _should_concurrent_collect = v;
 415   }
 416 
 417   // The amount to increase the high-water-mark (_capacity_until_GC)
 418   static size_t delta_capacity_until_GC(size_t bytes);
 419 
 420   // Tells if we have can expand metaspace without hitting set limits.
 421   static bool can_expand(size_t words, bool is_class);
 422 
 423   // Returns amount that we can expand without hitting a GC,
 424   // measured in words.
 425   static size_t allowed_expansion();
 426 
 427   // Calculate the new high-water mark at which to induce
 428   // a GC.
 429   static void compute_new_size();