0N/A/*
3157N/A * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#include "precompiled.hpp"
1879N/A#include "classfile/systemDictionary.hpp"
4141N/A#include "gc_implementation/shared/gcHeapSummary.hpp"
4141N/A#include "gc_implementation/shared/gcTrace.hpp"
4141N/A#include "gc_implementation/shared/gcTraceTime.hpp"
4141N/A#include "gc_implementation/shared/gcWhen.hpp"
1879N/A#include "gc_implementation/shared/vmGCOperations.hpp"
4359N/A#include "gc_interface/allocTracer.hpp"
1879N/A#include "gc_interface/collectedHeap.hpp"
1879N/A#include "gc_interface/collectedHeap.inline.hpp"
1879N/A#include "oops/oop.inline.hpp"
2845N/A#include "oops/instanceMirrorKlass.hpp"
1879N/A#include "runtime/init.hpp"
1879N/A#include "services/heapDumper.hpp"
1879N/A#ifdef TARGET_OS_FAMILY_linux
1879N/A# include "thread_linux.inline.hpp"
1879N/A#endif
1879N/A#ifdef TARGET_OS_FAMILY_solaris
1879N/A# include "thread_solaris.inline.hpp"
1879N/A#endif
1879N/A#ifdef TARGET_OS_FAMILY_windows
1879N/A# include "thread_windows.inline.hpp"
1879N/A#endif
2796N/A#ifdef TARGET_OS_FAMILY_bsd
2796N/A# include "thread_bsd.inline.hpp"
2796N/A#endif
0N/A
0N/A
0N/A#ifdef ASSERT
0N/Aint CollectedHeap::_fire_out_of_memory_count = 0;
0N/A#endif
0N/A
481N/Asize_t CollectedHeap::_filler_array_max_size = 0;
481N/A
4472N/Aconst char* CollectedHeap::OverflowMessage
4472N/A = "The size of the object heap + perm gen exceeds the maximum representable size";
4472N/A
3157N/Atemplate <>
3157N/Avoid EventLogBase<GCMessage>::print(outputStream* st, GCMessage& m) {
3157N/A st->print_cr("GC heap %s", m.is_before ? "before" : "after");
3157N/A st->print_raw(m);
3157N/A}
3157N/A
3157N/Avoid GCHeapLog::log_heap(bool before) {
3157N/A if (!should_log()) {
3157N/A return;
3157N/A }
3157N/A
3233N/A double timestamp = fetch_timestamp();
3157N/A MutexLockerEx ml(&_mutex, Mutex::_no_safepoint_check_flag);
3157N/A int index = compute_log_index();
3157N/A _records[index].thread = NULL; // Its the GC thread so it's not that interesting.
3157N/A _records[index].timestamp = timestamp;
3157N/A _records[index].data.is_before = before;
3157N/A stringStream st(_records[index].data.buffer(), _records[index].data.size());
3157N/A if (before) {
3233N/A Universe::print_heap_before_gc(&st, true);
3157N/A } else {
3233N/A Universe::print_heap_after_gc(&st, true);
3157N/A }
3157N/A}
3157N/A
4141N/AVirtualSpaceSummary CollectedHeap::create_heap_space_summary() {
4141N/A size_t capacity_in_words = capacity() / HeapWordSize;
4141N/A
4141N/A return VirtualSpaceSummary(
4141N/A reserved_region().start(), reserved_region().start() + capacity_in_words, reserved_region().end());
4141N/A}
4141N/A
4141N/AGCHeapSummary CollectedHeap::create_heap_summary() {
4141N/A VirtualSpaceSummary heap_space = create_heap_space_summary();
4141N/A return GCHeapSummary(heap_space, used());
4141N/A}
4141N/A
4141N/APermGenSummary CollectedHeap::create_perm_gen_summary() {
4141N/A VirtualSpaceSummary perm_space = create_perm_gen_space_summary();
4141N/A SpaceSummary object_space(perm_space.start(), perm_space.committed_end(), permanent_used());
4141N/A
4141N/A return PermGenSummary(perm_space, object_space);
4141N/A}
4141N/A
4141N/Avoid CollectedHeap::print_heap_before_gc() {
4141N/A if (PrintHeapAtGC) {
4141N/A Universe::print_heap_before_gc();
4141N/A }
4141N/A if (_gc_heap_log != NULL) {
4141N/A _gc_heap_log->log_heap_before();
4141N/A }
4141N/A}
4141N/A
4141N/Avoid CollectedHeap::print_heap_after_gc() {
4141N/A if (PrintHeapAtGC) {
4141N/A Universe::print_heap_after_gc();
4141N/A }
4141N/A if (_gc_heap_log != NULL) {
4141N/A _gc_heap_log->log_heap_after();
4141N/A }
4141N/A}
4141N/A
4141N/Avoid CollectedHeap::trace_heap(GCWhen::Type when, GCTracer* gc_tracer) {
4141N/A const GCHeapSummary& heap_summary = create_heap_summary();
4141N/A const PermGenSummary& perm_summary = create_perm_gen_summary();
4141N/A gc_tracer->report_gc_heap_summary(when, heap_summary, perm_summary);
4141N/A}
4141N/A
4141N/Avoid CollectedHeap::trace_heap_before_gc(GCTracer* gc_tracer) {
4141N/A trace_heap(GCWhen::BeforeGC, gc_tracer);
4141N/A}
4141N/A
4141N/Avoid CollectedHeap::trace_heap_after_gc(GCTracer* gc_tracer) {
4141N/A trace_heap(GCWhen::AfterGC, gc_tracer);
4141N/A}
Error!

 

There was an error!

null

java.lang.NullPointerException