/* * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2022 SAP SE. 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. *
*/
// Total malloc'd memory used by arenas
size_t MallocMemorySnapshot::total_arena() const {
size_t amount = 0; for (int index = 0; index < mt_number_of_types; index ++) {
amount += _malloc[index].arena_size();
} return amount;
}
// Make adjustment by subtracting chunks used by arenas // from total chunks to get total free chunk size void MallocMemorySnapshot::make_adjustment() {
size_t arena_size = total_arena(); int chunk_idx = NMTUtil::flag_to_index(mtChunk);
_malloc[chunk_idx].record_free(arena_size);
_all_mallocs.deallocate(arena_size);
}
// Given a pointer, if it seems to point to the start of a valid malloced block, // print the block. Note that since there is very low risk of memory looking // accidentally like a valid malloc block header (canaries and all) this is not // totally failproof. Only use this during debugging or when you can afford // signals popping up, e.g. when writing an hs_err file. bool MallocTracker::print_pointer_information(constvoid* p, outputStream* st) {
assert(MemTracker::enabled(), "NMT must be enabled"); if (os::is_readable_pointer(p)) { const NMT_TrackingLevel tracking_level = MemTracker::tracking_level(); const MallocHeader* mhdr = malloc_header(p); char msg[256];
address p_corrupted; if (os::is_readable_pointer(mhdr) &&
mhdr->check_block_integrity(msg, sizeof(msg), &p_corrupted)) {
st->print_cr(PTR_FORMAT " malloc'd " SIZE_FORMAT " bytes by %s",
p2i(p), mhdr->size(), NMTUtil::flag_to_name(mhdr->flags())); if (tracking_level == NMT_detail) {
NativeCallStack ncs; if (mhdr->get_stack(ncs)) {
ncs.print_on(st);
st->cr();
}
} returntrue;
}
} returnfalse;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
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.