1 /*
2 * Copyright (c) 2003, 2005, 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 *
23 */
24
25 // A memory manager is responsible for managing one or more memory pools.
26 // The garbage collector is one type of memory managers responsible
27 // for reclaiming memory occupied by unreachable objects. A Java virtual
28 // machine may have one or more memory managers. It may
29 // add or remove memory managers during execution.
30 // A memory pool can be managed by more than one memory managers.
31
32 class MemoryPool;
33 class GCMemoryManager;
34 class OopClosure;
35
36 class MemoryManager : public CHeapObj {
37 private:
38 enum {
39 max_num_pools = 10
40 };
41
42 MemoryPool* _pools[max_num_pools];
43 int _num_pools;
44
246 const char* name() { return "PS MarkSweep"; }
247 };
248
249 class G1YoungGenMemoryManager : public GCMemoryManager {
250 private:
251 public:
252 G1YoungGenMemoryManager() : GCMemoryManager() {}
253
254 MemoryManager::Name kind() { return MemoryManager::G1YoungGen; }
255 const char* name() { return "G1 Young Generation"; }
256 };
257
258 class G1OldGenMemoryManager : public GCMemoryManager {
259 private:
260 public:
261 G1OldGenMemoryManager() : GCMemoryManager() {}
262
263 MemoryManager::Name kind() { return MemoryManager::G1OldGen; }
264 const char* name() { return "G1 Old Generation"; }
265 };
|
1 /*
2 * Copyright (c) 2003, 2010, 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 *
23 */
24
25 #ifndef SHARE_VM_SERVICES_MEMORYMANAGER_HPP
26 #define SHARE_VM_SERVICES_MEMORYMANAGER_HPP
27
28 #include "memory/allocation.hpp"
29 #include "runtime/timer.hpp"
30 #include "services/memoryUsage.hpp"
31
32 // A memory manager is responsible for managing one or more memory pools.
33 // The garbage collector is one type of memory managers responsible
34 // for reclaiming memory occupied by unreachable objects. A Java virtual
35 // machine may have one or more memory managers. It may
36 // add or remove memory managers during execution.
37 // A memory pool can be managed by more than one memory managers.
38
39 class MemoryPool;
40 class GCMemoryManager;
41 class OopClosure;
42
43 class MemoryManager : public CHeapObj {
44 private:
45 enum {
46 max_num_pools = 10
47 };
48
49 MemoryPool* _pools[max_num_pools];
50 int _num_pools;
51
253 const char* name() { return "PS MarkSweep"; }
254 };
255
256 class G1YoungGenMemoryManager : public GCMemoryManager {
257 private:
258 public:
259 G1YoungGenMemoryManager() : GCMemoryManager() {}
260
261 MemoryManager::Name kind() { return MemoryManager::G1YoungGen; }
262 const char* name() { return "G1 Young Generation"; }
263 };
264
265 class G1OldGenMemoryManager : public GCMemoryManager {
266 private:
267 public:
268 G1OldGenMemoryManager() : GCMemoryManager() {}
269
270 MemoryManager::Name kind() { return MemoryManager::G1OldGen; }
271 const char* name() { return "G1 Old Generation"; }
272 };
273
274 #endif // SHARE_VM_SERVICES_MEMORYMANAGER_HPP
|