src/share/vm/services/memoryPool.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File bug_jdk8041623 Sdiff src/share/vm/services

src/share/vm/services/memoryPool.cpp

Print this page


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


  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/javaCalls.hpp"
  32 #include "runtime/orderAccess.inline.hpp"
  33 #include "services/lowMemoryDetector.hpp"
  34 #include "services/management.hpp"
  35 #include "services/memoryManager.hpp"
  36 #include "services/memoryPool.hpp"
  37 #include "utilities/macros.hpp"
  38 #include "utilities/globalDefinitions.hpp"
  39 
  40 MemoryPool::MemoryPool(const char* name,
  41                        PoolType type,
  42                        size_t init_size,
  43                        size_t max_size,
  44                        bool support_usage_threshold,
  45                        bool support_gc_threshold) {
  46   _name = name;
  47   _initial_size = init_size;
  48   _max_size = max_size;
  49   (void)const_cast<instanceOop&>(_memory_pool_obj = NULL);
  50   _available_for_allocation = true;
  51   _num_managers = 0;
  52   _type = type;
  53 
  54   // initialize the max and init size of collection usage
  55   _after_gc_usage = MemoryUsage(_initial_size, 0, 0, _max_size);
  56 
  57   _usage_sensor = NULL;
  58   _gc_usage_sensor = NULL;
  59   // usage threshold supports both high and low threshold
  60   _usage_threshold = new ThresholdSupport(support_usage_threshold, support_usage_threshold);
  61   // gc usage threshold supports only high threshold
  62   _gc_usage_threshold = new ThresholdSupport(support_gc_threshold, support_gc_threshold);
  63 }
  64 
  65 void MemoryPool::add_manager(MemoryManager* mgr) {
  66   assert(_num_managers < MemoryPool::max_num_managers, "_num_managers exceeds the max");
  67   if (_num_managers < MemoryPool::max_num_managers) {
  68     _managers[_num_managers] = mgr;
  69     _num_managers++;


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


  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/javaCalls.hpp"
  32 #include "runtime/orderAccess.inline.hpp"
  33 #include "services/lowMemoryDetector.hpp"
  34 #include "services/management.hpp"
  35 #include "services/memoryManager.hpp"
  36 #include "services/memoryPool.hpp"
  37 #include "utilities/macros.hpp"
  38 #include "utilities/globalDefinitions.hpp"
  39 
  40 MemoryPool::MemoryPool(const char* name,
  41                        PoolType type,
  42                        size_t init_size,
  43                        size_t max_size,
  44                        bool support_usage_threshold,
  45                        bool support_gc_threshold) {
  46   _name = name;
  47   _initial_size = init_size;
  48   _max_size = max_size;
  49   (void)const_cast<instanceOop&>(_memory_pool_obj = instanceOop(NULL));
  50   _available_for_allocation = true;
  51   _num_managers = 0;
  52   _type = type;
  53 
  54   // initialize the max and init size of collection usage
  55   _after_gc_usage = MemoryUsage(_initial_size, 0, 0, _max_size);
  56 
  57   _usage_sensor = NULL;
  58   _gc_usage_sensor = NULL;
  59   // usage threshold supports both high and low threshold
  60   _usage_threshold = new ThresholdSupport(support_usage_threshold, support_usage_threshold);
  61   // gc usage threshold supports only high threshold
  62   _gc_usage_threshold = new ThresholdSupport(support_gc_threshold, support_gc_threshold);
  63 }
  64 
  65 void MemoryPool::add_manager(MemoryManager* mgr) {
  66   assert(_num_managers < MemoryPool::max_num_managers, "_num_managers exceeds the max");
  67   if (_num_managers < MemoryPool::max_num_managers) {
  68     _managers[_num_managers] = mgr;
  69     _num_managers++;


src/share/vm/services/memoryPool.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File