Skip to content
🤔 Documentation issue? Report it

//leakcanary-repo/shark/HeapObject/HeapClass

HeapClass

[jvm]\ class HeapClass : HeapObject

A class in the heap dump.

Functions

Name Summary
get [jvm]
operator fun get(fieldName: String): HeapField?
instanceFieldName [jvm]
fun instanceFieldName(fieldRecord: HprofRecord.HeapDumpRecord.ObjectRecord.ClassDumpRecord.FieldRecord): String
Returns the name of the field declared in this class for the specified fieldRecord.
readFieldsByteSize [jvm]
fun readFieldsByteSize(): Int
The total byte size of fields for instances of this class, computed as the sum of the individual size of each field of this class. This does not include the size of fields from superclasses.
readRecord [jvm]
open override fun readRecord(): HprofRecord.HeapDumpRecord.ObjectRecord.ClassDumpRecord
Reads and returns the underlying ClassDumpRecord.
readRecordFields [jvm]
fun readRecordFields(): List<HprofRecord.HeapDumpRecord.ObjectRecord.ClassDumpRecord.FieldRecord>
readRecordStaticFields [jvm]
fun readRecordStaticFields(): List<HprofRecord.HeapDumpRecord.ObjectRecord.ClassDumpRecord.StaticFieldRecord>
readStaticField [jvm]
fun readStaticField(fieldName: String): HeapField?
Returns a HeapField object that reflects the specified declared field of the class represented by this HeapClass object, or null if this field does not exist. The name parameter specifies the simple name of the desired field.
readStaticFields [jvm]
fun readStaticFields(): Sequence<HeapField>
The static fields of this class, as a sequence of HeapField.
subclassOf [jvm]
infix fun subclassOf(superclass: HeapObject.HeapClass): Boolean
Returns true if superclass is a superclass of this HeapClass.
superclassOf [jvm]
infix fun superclassOf(subclass: HeapObject.HeapClass): Boolean
Returns true if subclass is a sub class of this HeapClass.
toString [jvm]
open override fun toString(): String

Properties

Name Summary
asClass [jvm]
val asClass: HeapObject.HeapClass?
This HeapObject as a HeapClass if it is one, or null otherwise
asInstance [jvm]
val asInstance: HeapObject.HeapInstance?
This HeapObject as a HeapInstance if it is one, or null otherwise
asObjectArray [jvm]
val asObjectArray: HeapObject.HeapObjectArray?
This HeapObject as a HeapObjectArray if it is one, or null otherwise
asPrimitiveArray [jvm]
val asPrimitiveArray: HeapObject.HeapPrimitiveArray?
This HeapObject as a HeapPrimitiveArray if it is one, or null otherwise
classHierarchy [jvm]
val classHierarchy: Sequence<HeapObject.HeapClass>
The class hierarchy starting at this class (included) and ending at the Object class (included).
directInstances [jvm]
val directInstances: Sequence<HeapObject.HeapInstance>
All direct instances of this class, ie excluding any instance of subclasses of this class.
graph [jvm]
open override val graph: HeapGraph
The graph of objects in the heap, which you can use to navigate the heap.
hasReferenceInstanceFields [jvm]
val hasReferenceInstanceFields: Boolean
instanceByteSize [jvm]
val instanceByteSize: Int
The total byte size of fields for instances of this class, as registered in the class dump. This includes the size of fields from superclasses.
instances [jvm]
val instances: Sequence<HeapObject.HeapInstance>
All instances of this class, including instances of subclasses of this class.
isArrayClass [jvm]
val isArrayClass: Boolean
Returns true if this class is an array class, and false otherwise.
isObjectArrayClass [jvm]
val isObjectArrayClass: Boolean
isPrimitiveArrayClass [jvm]
val isPrimitiveArrayClass: Boolean
isPrimitiveWrapperClass [jvm]
val isPrimitiveWrapperClass: Boolean
Whether this is class is a primitive wrapper type
name [jvm]
val name: String
The name of this class, identical to Class.getName. If this class is an array class, the name has a suffix of brackets for each dimension of the array, e.g. com.Foo[][] is a class for 2 dimensional arrays of com.Foo.
objectArrayInstances [jvm]
val objectArrayInstances: Sequence<HeapObject.HeapObjectArray>
objectId [jvm]
open override val objectId: Long
The heap identifier of this object.
objectIndex [jvm]
open override val objectIndex: Int
An positive object index that’s specific to how Shark stores objects in memory. The index starts at 0 and ends at HeapGraph.objectCount - 1. There are no gaps, every index value corresponds to an object. Classes are first, then instances, then object arrays then primitive arrays.
positiveObjectId [jvm]
val positiveObjectId: Long
objectId masked to be a positive unique identifier, as reported in Android Studio.
primitiveArrayInstances [jvm]
val primitiveArrayInstances: Sequence<HeapObject.HeapPrimitiveArray>
Primitive arrays are one dimensional arrays of a primitive type. N-dimension arrays of primitive types (e.g. int[][]) are object arrays pointing to primitive arrays.
recordSize [jvm]
open override val recordSize: Int
The total byte size for the record of this object in the heap dump.
simpleName [jvm]
val simpleName: String
Returns name stripped of any string content before the last period (included).
subclasses [jvm]
val subclasses: Sequence<HeapObject.HeapClass>
All the subclasses (direct and indirect) of this class, in the order they were recorded in the heap dump.
superclass [jvm]
val superclass: HeapObject.HeapClass?
The HeapClass representing the superclass of this HeapClass. If this HeapClass represents either the Object class or a primitive type, then null is returned. If this HeapClass represents an array class then the HeapClass object representing the Object class is returned.