src/share/vm/services/memoryPool.hpp

Print this page
rev 4210 : 8000754: NPG: Implement a MemoryPool MXBean for Metaspace


  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 #ifndef SHARE_VM_SERVICES_MEMORYPOOL_HPP
  26 #define SHARE_VM_SERVICES_MEMORYPOOL_HPP
  27 
  28 #include "gc_implementation/shared/mutableSpace.hpp"
  29 #include "memory/defNewGeneration.hpp"
  30 #include "memory/heap.hpp"

  31 #include "memory/space.hpp"
  32 #include "services/memoryUsage.hpp"
  33 #include "utilities/macros.hpp"
  34 #if INCLUDE_ALL_GCS
  35 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
  36 #endif // INCLUDE_ALL_GCS
  37 
  38 // A memory pool represents the memory area that the VM manages.
  39 // The Java virtual machine has at least one memory pool
  40 // and it may create or remove memory pools during execution.
  41 // A memory pool can belong to the heap or the non-heap memory.
  42 // A Java virtual machine may also have memory pools belonging to
  43 // both heap and non-heap memory.
  44 
  45 // Forward declaration
  46 class MemoryManager;
  47 class SensorInfo;
  48 class Generation;
  49 class DefNewGeneration;
  50 class ThresholdSupport;


 203 #endif // INCLUDE_ALL_GCS
 204 
 205 
 206 class GenerationPool : public CollectedMemoryPool {
 207 private:
 208   Generation* _gen;
 209 public:
 210   GenerationPool(Generation* gen, const char* name, PoolType type, bool support_usage_threshold);
 211 
 212   MemoryUsage get_memory_usage();
 213   size_t used_in_bytes()                { return _gen->used(); }
 214 };
 215 
 216 class CodeHeapPool: public MemoryPool {
 217 private:
 218   CodeHeap* _codeHeap;
 219 public:
 220   CodeHeapPool(CodeHeap* codeHeap, const char* name, bool support_usage_threshold);
 221   MemoryUsage get_memory_usage();
 222   size_t used_in_bytes()            { return _codeHeap->allocated_capacity(); }

























 223 };
 224 
 225 #endif // SHARE_VM_SERVICES_MEMORYPOOL_HPP


  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 #ifndef SHARE_VM_SERVICES_MEMORYPOOL_HPP
  26 #define SHARE_VM_SERVICES_MEMORYPOOL_HPP
  27 
  28 #include "gc_implementation/shared/mutableSpace.hpp"
  29 #include "memory/defNewGeneration.hpp"
  30 #include "memory/heap.hpp"
  31 #include "memory/metaspace.hpp"
  32 #include "memory/space.hpp"
  33 #include "services/memoryUsage.hpp"
  34 #include "utilities/macros.hpp"
  35 #if INCLUDE_ALL_GCS
  36 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
  37 #endif // INCLUDE_ALL_GCS
  38 
  39 // A memory pool represents the memory area that the VM manages.
  40 // The Java virtual machine has at least one memory pool
  41 // and it may create or remove memory pools during execution.
  42 // A memory pool can belong to the heap or the non-heap memory.
  43 // A Java virtual machine may also have memory pools belonging to
  44 // both heap and non-heap memory.
  45 
  46 // Forward declaration
  47 class MemoryManager;
  48 class SensorInfo;
  49 class Generation;
  50 class DefNewGeneration;
  51 class ThresholdSupport;


 204 #endif // INCLUDE_ALL_GCS
 205 
 206 
 207 class GenerationPool : public CollectedMemoryPool {
 208 private:
 209   Generation* _gen;
 210 public:
 211   GenerationPool(Generation* gen, const char* name, PoolType type, bool support_usage_threshold);
 212 
 213   MemoryUsage get_memory_usage();
 214   size_t used_in_bytes()                { return _gen->used(); }
 215 };
 216 
 217 class CodeHeapPool: public MemoryPool {
 218 private:
 219   CodeHeap* _codeHeap;
 220 public:
 221   CodeHeapPool(CodeHeap* codeHeap, const char* name, bool support_usage_threshold);
 222   MemoryUsage get_memory_usage();
 223   size_t used_in_bytes()            { return _codeHeap->allocated_capacity(); }
 224 };
 225 
 226 class MetaspacePoolBase : public MemoryPool {
 227 private:
 228   Metaspace::MetadataType _md_type;
 229 protected:
 230   static const size_t _undefined_max_size = (size_t) -1;
 231 public:
 232   MetaspacePoolBase(const char *name, Metaspace::MetadataType md_type, size_t max_size);
 233   MemoryUsage get_memory_usage();
 234   size_t used_in_bytes();
 235 };
 236 
 237 class ClassMetaspacePool : public MetaspacePoolBase {
 238 private:
 239   size_t calculate_max_size();
 240 public:
 241   ClassMetaspacePool();
 242 };
 243 
 244 class MetaspacePool : public MetaspacePoolBase {
 245 private:
 246   size_t calculate_max_size();
 247 public:
 248   MetaspacePool();
 249 };
 250 
 251 #endif // SHARE_VM_SERVICES_MEMORYPOOL_HPP