1 /*
2 * Copyright (c) 2007, 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 class G1CollectedHeap;
26
27 // This file contains the three classes that represent the memory
28 // pools of the G1 spaces: G1EdenPool, G1SurvivorPool, and
29 // G1OldGenPool. In G1, unlike our other GCs, we do not have a
30 // physical space for each of those spaces. Instead, we allocate
31 // regions for all three spaces out of a single pool of regions (that
32 // pool basically covers the entire heap). As a result, the eden,
33 // survivor, and old gen are considered logical spaces in G1, as each
34 // is a set of non-contiguous regions. This is also reflected in the
35 // way we map them to memory pools here. The easiest way to have done
36 // this would have been to map the entire G1 heap to a single memory
37 // pool. However, it's helpful to show how large the eden and survivor
38 // get, as this does affect the performance and behavior of G1. Which
39 // is why we introduce the three memory pools implemented here.
40 //
41 // The above approach inroduces a couple of challenging issues in the
42 // implementation of the three memory pools:
43 //
44 // 1) The used space calculation for a pool is not necessarily
181 }
182 size_t max_size() const {
183 return undefined_max();
184 }
185 MemoryUsage get_memory_usage();
186 };
187
188 // Memory pool that represents the G1 old gen.
189 class G1OldGenPool : public G1MemoryPoolSuper {
190 public:
191 G1OldGenPool(G1CollectedHeap* g1h);
192
193 size_t used_in_bytes() {
194 return old_space_used(_g1h);
195 }
196 size_t max_size() const {
197 return undefined_max();
198 }
199 MemoryUsage get_memory_usage();
200 };
|
1 /*
2 * Copyright (c) 2007, 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_G1MEMORYPOOL_HPP
26 #define SHARE_VM_SERVICES_G1MEMORYPOOL_HPP
27
28 #ifndef SERIALGC
29 #include "services/memoryPool.hpp"
30 #include "services/memoryUsage.hpp"
31 #endif
32
33 class G1CollectedHeap;
34
35 // This file contains the three classes that represent the memory
36 // pools of the G1 spaces: G1EdenPool, G1SurvivorPool, and
37 // G1OldGenPool. In G1, unlike our other GCs, we do not have a
38 // physical space for each of those spaces. Instead, we allocate
39 // regions for all three spaces out of a single pool of regions (that
40 // pool basically covers the entire heap). As a result, the eden,
41 // survivor, and old gen are considered logical spaces in G1, as each
42 // is a set of non-contiguous regions. This is also reflected in the
43 // way we map them to memory pools here. The easiest way to have done
44 // this would have been to map the entire G1 heap to a single memory
45 // pool. However, it's helpful to show how large the eden and survivor
46 // get, as this does affect the performance and behavior of G1. Which
47 // is why we introduce the three memory pools implemented here.
48 //
49 // The above approach inroduces a couple of challenging issues in the
50 // implementation of the three memory pools:
51 //
52 // 1) The used space calculation for a pool is not necessarily
189 }
190 size_t max_size() const {
191 return undefined_max();
192 }
193 MemoryUsage get_memory_usage();
194 };
195
196 // Memory pool that represents the G1 old gen.
197 class G1OldGenPool : public G1MemoryPoolSuper {
198 public:
199 G1OldGenPool(G1CollectedHeap* g1h);
200
201 size_t used_in_bytes() {
202 return old_space_used(_g1h);
203 }
204 size_t max_size() const {
205 return undefined_max();
206 }
207 MemoryUsage get_memory_usage();
208 };
209
210 #endif // SHARE_VM_SERVICES_G1MEMORYPOOL_HPP
|