src/share/vm/services/psMemoryPool.hpp

Fri, 27 Aug 2010 13:34:14 -0400

author
tonyp
date
Fri, 27 Aug 2010 13:34:14 -0400
changeset 2112
1c63587d925b
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
permissions
-rw-r--r--

6980206: G1: assert(has_undefined_max_size, "Undefined max size");
Summary: An assert in the management.cpp is too strong and assumes the max size is always defined on memory pools, even when we don't need to use it.
Reviewed-by: mchung, johnc

     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  */
    25 class PSGenerationPool : public CollectedMemoryPool {
    26 private:
    27   PSOldGen* _gen;
    29 public:
    30   PSGenerationPool(PSOldGen* pool, const char* name, PoolType type, bool support_usage_threshold);
    31   PSGenerationPool(PSPermGen* pool, const char* name, PoolType type, bool support_usage_threshold);
    33   MemoryUsage get_memory_usage();
    34   size_t used_in_bytes()              { return _gen->used_in_bytes(); }
    35   size_t max_size() const             { return _gen->reserved().byte_size(); }
    36 };
    38 class EdenMutableSpacePool : public CollectedMemoryPool {
    39 private:
    40   PSYoungGen*   _gen;
    41   MutableSpace* _space;
    43 public:
    44   EdenMutableSpacePool(PSYoungGen* gen,
    45                        MutableSpace* space,
    46                        const char* name,
    47                        PoolType type,
    48                        bool support_usage_threshold);
    50   MutableSpace* space()                     { return _space; }
    51   MemoryUsage get_memory_usage();
    52   size_t used_in_bytes()                    { return space()->used_in_bytes(); }
    53   size_t max_size() const {
    54     // Eden's max_size = max_size of Young Gen - the current committed size of survivor spaces
    55     return _gen->max_size() - _gen->from_space()->capacity_in_bytes() - _gen->to_space()->capacity_in_bytes();
    56   }
    57 };
    59 class SurvivorMutableSpacePool : public CollectedMemoryPool {
    60 private:
    61   PSYoungGen*   _gen;
    63 public:
    64   SurvivorMutableSpacePool(PSYoungGen* gen,
    65                            const char* name,
    66                            PoolType type,
    67                            bool support_usage_threshold);
    69   MemoryUsage get_memory_usage();
    71   size_t used_in_bytes() {
    72     return _gen->from_space()->used_in_bytes();
    73   }
    74   size_t committed_in_bytes() {
    75     return _gen->from_space()->capacity_in_bytes();
    76   }
    77   size_t max_size() const {
    78     // Return current committed size of the from-space
    79     return _gen->from_space()->capacity_in_bytes();
    80   }
    81 };

mercurial