Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Static Public Member Functions | Package Functions | Package Attributes | Static Package Attributes | Private Member Functions
Leak Class Reference
Inheritance diagram for Leak:
Inheritance graph
[legend]
Collaboration diagram for Leak:
Collaboration graph
[legend]

List of all members.

Classes

class  ByChildCount
 Sorts in order of decreasing number of children. More...
class  ByRefCount
 Sorts in order of increasing reference count. More...
class  ByTotalSize
 Sorts in order of decreasing total size. More...

Public Member Functions

String toString ()
boolean contains (long address)
 Tests whether ref is an interior pointer into this reference.

Static Public Member Functions

static Reference findNearest (Reference[] sortedRefs, int address)

Package Functions

 Leak (String addr, Type type, Object[] refs, long crawlOffset, short crawlCount)
void setParents (Vector parents)
void computeTotalSize ()
void clearTotalSize ()
void clearMarks ()
void printGraph (PrintWriter out)
void printCycle (PrintWriter out)

Package Attributes

String mName
long mCrawlOffset
short mCrawlCount
short mRefCount
short mChildCount
Leak[] mParents
int mTotalSize
boolean mMarked
int mAddress
Type mType
Object[] mReferences

Static Package Attributes

static final char INDENT = '\t'

Private Member Functions

void printGraph (PrintWriter out, int indent)
void printCycle (PrintWriter out, int indent)

Detailed Description

Definition at line 40 of file leaksoup.java.


Constructor & Destructor Documentation

Leak.Leak ( String  addr,
Type  type,
Object[]  refs,
long  crawlOffset,
short  crawlCount 
) [inline, package]

Definition at line 50 of file leaksoup.java.

                                                                                       {
           super(addr, type, refs);
           mName = addr;
              mCrawlOffset = crawlOffset;
              mCrawlCount = crawlCount;
              mRefCount = 0;
              mChildCount = 0;
              mParents = null;
              mTotalSize = 0;
              mMarked = false;
       }

Here is the caller graph for this function:


Member Function Documentation

void Leak.clearMarks ( ) [inline, package]

Definition at line 105 of file leaksoup.java.

                         {
              // first, clear mark.
              mMarked = false;
              
              // then, visit all nodes that haven't been visited,
              // and clear each one's mark.
              int count = mReferences.length;
              for (int i = 0; i < count; ++i) {
                     Object ref = mReferences[i];
                     if (ref instanceof Leak) {
                            Leak leak = (Leak) ref;
                            if (leak.mMarked)
                                   leak.clearMarks();
                     }
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void Leak.clearTotalSize ( ) [inline, package]

Definition at line 88 of file leaksoup.java.

                             {
              // first, clear our total size.
              mTotalSize = 0;
              
              // then, visit all nodes that haven't been visited,
              // and clear each one's total size.
              int count = mReferences.length;
              for (int i = 0; i < count; ++i) {
                     Object ref = mReferences[i];
                     if (ref instanceof Leak) {
                            Leak leak = (Leak) ref;
                            if (leak.mTotalSize != 0)
                                   leak.clearTotalSize();
                     }
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void Leak.computeTotalSize ( ) [inline, package]

Definition at line 67 of file leaksoup.java.

                               {
              // first, mark this node as having been visited.
              // we only want to include nodes that haven't been
              // visited in our total size.
              mTotalSize = mType.mSize;
              
              // then, visit all nodes that haven't been visited,
              // and include their total size in ours.
              int count = mReferences.length;
              for (int i = 0; i < count; ++i) {
                     Object ref = mReferences[i];
                     if (ref instanceof Leak) {
                            Leak leak = (Leak) ref;
                            if (leak.mTotalSize == 0) {
                                   leak.computeTotalSize();
                                   mTotalSize += leak.mTotalSize;
                            }
                     }
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

boolean Reference.contains ( long  address) [inline, inherited]

Tests whether ref is an interior pointer into this reference.

Definition at line 54 of file Reference.java.

                                          {
        return (mAddress <= address && address < (mAddress + mType.mSize));
    }
static Reference Reference.findNearest ( Reference[]  sortedRefs,
int  address 
) [inline, static, inherited]

Definition at line 68 of file Reference.java.

                                                                             {
              int length = sortedRefs.length;
              int minIndex = 0, maxIndex = length - 1;
              int index = maxIndex / 2;
              while (minIndex <= maxIndex) {
                     Reference ref = sortedRefs[index];
                     if (address < ref.mAddress) {
                            maxIndex = (index - 1);
                            index = (minIndex + maxIndex) / 2;
                     } else {
                            if (address < (ref.mAddress + ref.mType.mSize)) {
                                   return ref;
                            }
                            minIndex = (index + 1);
                            index = (minIndex + maxIndex) / 2;
                     }
              }
              return null;
    }

Here is the caller graph for this function:

void Leak.printCycle ( PrintWriter  out) [inline, package]

Definition at line 154 of file leaksoup.java.

                                        {
           printCycle(out, 0);
           clearMarks();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void Leak.printCycle ( PrintWriter  out,
int  indent 
) [inline, private]

Definition at line 159 of file leaksoup.java.

                                                            {
              // first, mark this node as having been visited.
              // we only want to include nodes that haven't been
              // visited in our total size.
              mMarked = true;
              
              // then, visit all nodes that haven't been visited,
              // and include their total size in ours.
              if (mChildCount > 0) {
                  // don't print leaf nodes in a cycle. they aren't interesting.
              for (int i = 0; i < indent; ++i)
                  out.print(INDENT);
              out.println(toString());
                  int subIndent = indent + 1;
              int count = mReferences.length;
              for (int i = 0; i < count; ++i) {
                     Object ref = mReferences[i];
                     if (ref instanceof Leak) {
                            Leak leak = (Leak) ref;
                            if (!leak.mMarked)
                                   leak.printCycle(out, subIndent);
                     }
              }
       }
       }

Here is the call graph for this function:

void Leak.printGraph ( PrintWriter  out) [inline, package]

Definition at line 124 of file leaksoup.java.

                                     {
           printGraph(out, 0);
           clearMarks();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void Leak.printGraph ( PrintWriter  out,
int  indent 
) [inline, private]

Definition at line 129 of file leaksoup.java.

                                                            {
              // first, mark this node as having been visited.
              // we only want to include nodes that haven't been
              // visited in our total size.
              mMarked = true;
              for (int i = 0; i < indent; ++i)
                  out.print(INDENT);
              out.println(toString());
              
              // then, visit all nodes that haven't been visited,
              // and include their total size in ours.
              int count = mReferences.length;
              if (count > 0) {
                  int subIndent = indent + 1;
              for (int i = 0; i < count; ++i) {
                     Object ref = mReferences[i];
                     if (ref instanceof Leak) {
                            Leak leak = (Leak) ref;
                            if (!leak.mMarked)
                                   leak.printGraph(out, subIndent);
                     }
              }
       }
       }

Here is the call graph for this function:

void Leak.setParents ( Vector  parents) [inline, package]

Definition at line 62 of file leaksoup.java.

                                       {
              mParents = new Leak[parents.size()];
              parents.copyInto(mParents);
       }

Here is the caller graph for this function:

String Leak.toString ( ) [inline]

Definition at line 185 of file leaksoup.java.

                                {
              return ("<A HREF=\"#" + mName + "\">" + mName + "</A> [" + mRefCount + "] " + mType + "{" + mTotalSize + "}");
       }

Here is the caller graph for this function:


Member Data Documentation

final char Leak.INDENT = '\t' [static, package]

Definition at line 122 of file leaksoup.java.

int Reference.mAddress [package, inherited]

Definition at line 41 of file Reference.java.

short Leak.mChildCount [package]

Definition at line 45 of file leaksoup.java.

short Leak.mCrawlCount [package]

Definition at line 43 of file leaksoup.java.

Definition at line 42 of file leaksoup.java.

boolean Leak.mMarked [package]

Definition at line 48 of file leaksoup.java.

String Leak.mName [package]

Definition at line 41 of file leaksoup.java.

Leak [] Leak.mParents [package]

Definition at line 46 of file leaksoup.java.

short Leak.mRefCount [package]

Definition at line 44 of file leaksoup.java.

Object [] Reference.mReferences [package, inherited]

Definition at line 43 of file Reference.java.

int Leak.mTotalSize [package]

Definition at line 47 of file leaksoup.java.

Type Reference.mType [package, inherited]

Definition at line 42 of file Reference.java.


The documentation for this class was generated from the following file: