Path: blob/master/src/hotspot/share/memory/metaspace/metaspaceSettings.hpp
40957 views
/*1* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2020 SAP SE. 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 it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 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 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef SHARE_MEMORY_METASPACE_METASPACESETTINGS_HPP26#define SHARE_MEMORY_METASPACE_METASPACESETTINGS_HPP2728#include "memory/allocation.hpp"29#include "memory/metaspace/chunklevel.hpp"30#include "utilities/globalDefinitions.hpp"3132namespace metaspace {3334class Settings : public AllStatic {3536// Granularity, in bytes, metaspace is committed with.37static size_t _commit_granule_bytes;3839// Granularity, in words, metaspace is committed with.40static size_t _commit_granule_words;4142// The default size of a VirtualSpaceNode, unless created with an explicitly specified size.43// Must be a multiple of the root chunk size.44// Increasing this value decreases the number of mappings used for metadata,45// at the cost of increased virtual size used for Metaspace (or, at least,46// coarser growth steps). Matters mostly for 32bit platforms due to limited47// address space.48// The default of two root chunks has been chosen on a whim but seems to work out okay49// (coming to a mapping size of 8m per node).50static const size_t _virtual_space_node_default_word_size = chunklevel::MAX_CHUNK_WORD_SIZE * 2;5152// Alignment of the base address of a virtual space node53static const size_t _virtual_space_node_reserve_alignment_words = chunklevel::MAX_CHUNK_WORD_SIZE;5455// When allocating from a chunk, if the remaining area in the chunk is too small to hold56// the requested size, we attempt to double the chunk size in place...57static const bool _enlarge_chunks_in_place = true;5859// Whether or not chunks handed out to an arena start out fully committed;60// if true, this deactivates committing-on-demand (regardless of whether61// we uncommit free chunks).62static bool _new_chunks_are_fully_committed;6364// If true, chunks equal or larger than a commit granule are uncommitted65// after being returned to the freelist.66static bool _uncommit_free_chunks;6768// If true, metablock allocations are guarded and periodically checked.69DEBUG_ONLY(static bool _use_allocation_guard;)7071// This enables or disables premature deallocation of metaspace allocated blocks. Using72// Metaspace::deallocate(), blocks can be returned prematurely (before the associated73// Arena dies, e.g. after class unloading) and can be reused by the arena.74// If disabled, those blocks will not be reused until the Arena dies.75// Note that premature deallocation is rare under normal circumstances.76// By default deallocation handling is enabled.77DEBUG_ONLY(static bool _handle_deallocations;)7879public:8081static size_t commit_granule_bytes() { return _commit_granule_bytes; }82static size_t commit_granule_words() { return _commit_granule_words; }83static bool new_chunks_are_fully_committed() { return _new_chunks_are_fully_committed; }84static size_t virtual_space_node_default_word_size() { return _virtual_space_node_default_word_size; }85static size_t virtual_space_node_reserve_alignment_words() { return _virtual_space_node_reserve_alignment_words; }86static bool enlarge_chunks_in_place() { return _enlarge_chunks_in_place; }87static bool uncommit_free_chunks() { return _uncommit_free_chunks; }88static bool use_allocation_guard() { return DEBUG_ONLY(_use_allocation_guard) NOT_DEBUG(false); }89static bool handle_deallocations() { return DEBUG_ONLY(_handle_deallocations) NOT_DEBUG(true); }9091static void ergo_initialize();9293static void print_on(outputStream* st);9495};9697} // namespace metaspace9899#endif // SHARE_MEMORY_METASPACE_METASPACESETTINGS_HPP100101102