FileDocCategorySizeDatePackage
Heap.javaAPI DocAndroid 1.5 API5544Wed May 06 22:41:02 BST 2009com.android.hit

Heap

public class Heap extends Object

Fields Summary
String
mName
HashMap
mFrames
HashMap
mTraces
ArrayList
mRoots
HashMap
mThreads
HashMap
mClassesById
HashMap
mClassesByName
HashMap
mInstances
State
mState
Constructors Summary
public Heap(String name)


       
        mName = name;
    
Methods Summary
public final voidaddClass(long id, ClassObj theClass)

        mClassesById.put(id, theClass);
        mClassesByName.put(theClass.mClassName, theClass);
    
public final voidaddInstance(long id, Instance instance)

        mInstances.put(id, instance);
    
public final voidaddRoot(RootObj root)

        root.mIndex = mRoots.size();
        mRoots.add(root);
    
public final voidaddStackFrame(StackFrame theFrame)

        mFrames.put(theFrame.mId, theFrame);
    
public final voidaddStackTrace(StackTrace theTrace)

        mTraces.put(theTrace.mSerialNumber, theTrace);
    
public final voidaddThread(ThreadObj thread, int serialNumber)

        mThreads.put(serialNumber, thread);
    
public final voiddumpInstanceCounts()

        for (ClassObj theClass: mClassesById.values()) {
            int count = theClass.mInstances.size();
            
            if (count > 0) {
                System.out.println(theClass + ": " + count);
            }
        }
    
public final voiddumpSizes()

        for (ClassObj theClass: mClassesById.values()) {
            int size = 0;
            
            for (Instance instance: theClass.mInstances) {
                size += instance.getCompositeSize();
            }

            if (size > 0) {
                System.out.println(theClass + ": base " + theClass.getSize()
                    + ", composite " + size);
            }
        }
    
public final voiddumpSubclasses()

        for (ClassObj theClass: mClassesById.values()) {
            int count = theClass.mSubclasses.size();
            
            if (count > 0) {
                System.out.println(theClass);
                theClass.dumpSubclasses();
            }
        }
    
public final ClassObjgetClass(long id)

        return mClassesById.get(id);
    
public final ClassObjgetClass(java.lang.String name)

        return mClassesByName.get(name);
    
public final InstancegetInstance(long id)

        return mInstances.get(id);
    
public final StackFramegetStackFrame(long id)

        return mFrames.get(id);
    
public final StackTracegetStackTrace(int traceSerialNumber)

        return mTraces.get(traceSerialNumber);
    
public final StackTracegetStackTraceAtDepth(int traceSerialNumber, int depth)

        StackTrace trace = mTraces.get(traceSerialNumber);
        
        if (trace != null) {
            trace = trace.fromDepth(depth);
        }
        
        return trace;
    
public final ThreadObjgetThread(int serialNumber)

        return mThreads.get(serialNumber);
    
public final voidresolveClassStatics(State state)

        for (ClassObj theClass: mClassesById.values()) {
            theClass.resolveReferences(state);
        }
    
public final voidresolveInstanceRefs(State state)

        for (Instance instance : mInstances.values()) {
            ClassObj theClass = mClassesById.get(instance.mClassId);

            if (theClass == null) {
                continue;
            }

            String name = theClass.mClassName;
            String superclassName = "none";
            ClassObj superClass = mClassesById.get(theClass.mSuperclassId);
            
            if (superClass != null) {
                superclassName = superClass.mClassName;
            }
            
            theClass.addInstance(instance);
            instance.resolveReferences(state);
        }
    
public final voidresolveRoots(State state)

        for (RootObj root: mRoots) {
            root.resolveReferences(state);
        }