|
Java example source code file (JavaHeapObject.java)
The JavaHeapObject.java Java example source code/* * Copyright (c) 1997, 2008, 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. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * 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. */ /* * The Original Code is HAT. The Initial Developer of the * Original Code is Bill Foote, with contributions from others * at JavaSoft/Sun. */ package com.sun.tools.hat.internal.model; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import com.sun.tools.hat.internal.util.Misc; /** * * @author Bill Foote */ /** * Represents an object that's allocated out of the Java heap. It occupies * memory in the VM, and is the sort of thing that in a JDK 1.1 VM had * a handle. It can be a * JavaClass, a JavaObjectArray, a JavaValueArray or a JavaObject. */ public abstract class JavaHeapObject extends JavaThing { // // Who we refer to. This is heavily optimized for space, because it's // well worth trading a bit of speed for less swapping. // referers and referersLen go through two phases: Building and // resolved. When building, referers might have duplicates, but can // be appended to. When resolved, referers has no duplicates or // empty slots. // private JavaThing[] referers = null; private int referersLen = 0; // -1 when resolved public abstract JavaClass getClazz(); public abstract int getSize(); public abstract long getId(); /** * Do any initialization this thing needs after its data is read in. * Subclasses that override this should call super.resolve(). */ public void resolve(Snapshot snapshot) { StackTrace trace = snapshot.getSiteTrace(this); if (trace != null) { trace.resolve(snapshot); } } // // Eliminate duplicates from referers, and size the array exactly. // This sets us up to answer queries. See the comments around the // referers data member for details. // void setupReferers() { if (referersLen > 1) { // Copy referers to map, screening out duplicates Map<JavaThing, JavaThing> map = new HashMap Other Java examples (source code examples)Here is a short list of links related to this Java JavaHeapObject.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.