/* * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// Use this as initial guesstimate. We should need less space in the // archive, but if we're wrong the bitmap will be expanded automatically.
size_t estimated_archive_size = MetaspaceGC::capacity_until_GC(); // But set it smaller in debug builds so we always test the expansion code. // (Default archive is about 12MB).
DEBUG_ONLY(estimated_archive_size = 6 * M);
// We need one bit per pointer in the archive.
_ptrmap->initialize(estimated_archive_size / sizeof(intptr_t));
}
if (ptr_base() <= ptr_loc && ptr_loc < ptr_end()) {
address value = *ptr_loc; // We don't want any pointer that points to very bottom of the archive, otherwise when // MetaspaceShared::default_base_address()==0, we can't distinguish between a pointer // to nothing (NULL) vs a pointer to an objects that happens to be at the very bottom // of the archive.
assert(value != (address)ptr_base(), "don't point to the bottom of the archive");
char* DumpRegion::expand_top_to(char* newtop) {
assert(is_allocatable(), "must be initialized and not packed");
assert(newtop >= _top, "must not grow backwards"); if (newtop > _end) {
ArchiveBuilder::current()->report_out_of_space(_name, newtop - _top);
ShouldNotReachHere();
}
commit_to(newtop);
_top = newtop;
if (_max_delta > 0) {
uintx delta = ArchiveBuilder::current()->buffer_to_offset((address)(newtop-1)); if (delta > _max_delta) { // This is just a sanity check and should not appear in any real world usage. This // happens only if you allocate more than 2GB of shared objects and would require // millions of shared classes.
vm_exit_during_initialization("Out of memory in the CDS archive", "Please reduce the number of shared classes.");
}
}
if (!_vs->expand_by(commit, false)) {
vm_exit_during_initialization(err_msg("Failed to expand shared space to " SIZE_FORMAT " bytes",
need_committed_size));
}
constchar* which; if (_rs->base() == (char*)MetaspaceShared::symbol_rs_base()) {
which = "symbol";
} else {
which = "shared";
}
log_debug(cds)("Expanding %s spaces by " SIZE_FORMAT_W(7) " bytes [total " SIZE_FORMAT_W(9) " bytes ending at %p]",
which, commit, _vs->actual_committed_size(), _vs->high());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.