Search in sources :

Example 1 with ImageSection

use of com.ibm.dtfj.image.j9.ImageSection in project openj9 by eclipse.

the class JavaObject method getSize.

/* (non-Javadoc)
	 * @see com.ibm.dtfj.java.JavaObject#getSize()
	 */
public long getSize() throws CorruptDataException {
    // this is the total number of bytes consumed by the object so we will total up the section sizes
    Iterator sections = getSections();
    long size = 0;
    // Originally came from Dump analyzer defect 74504.
    while (sections.hasNext()) {
        Object qsect = sections.next();
        if (qsect instanceof ImageSection) {
            ImageSection section = (ImageSection) qsect;
            size += section.getSize();
        } else {
            if (qsect instanceof CorruptData) {
                throw new CorruptDataException((CorruptData) qsect);
            } else {
                throw new RuntimeException("Found unexpected object " + qsect.getClass().getName());
            }
        }
    }
    return size;
}
Also used : Iterator(java.util.Iterator) ImageSection(com.ibm.dtfj.image.j9.ImageSection) CorruptData(com.ibm.dtfj.image.j9.CorruptData) CorruptDataException(com.ibm.dtfj.image.CorruptDataException)

Aggregations

CorruptDataException (com.ibm.dtfj.image.CorruptDataException)1 CorruptData (com.ibm.dtfj.image.j9.CorruptData)1 ImageSection (com.ibm.dtfj.image.j9.ImageSection)1 Iterator (java.util.Iterator)1