Documentation
¶
Overview ¶
heap provides functions for extracting meaningfull data from heap dump. For example, it is able to parse class hierarchies from HPROF_GC_CLASS_DUMP records into the linked-list like data structure or parse values of heap objects like instances of instances fields.
Assembling the such data requires a lot of references traverse by the identifiers of heap objects. Package dump.ParsedAccessor is used for that purpose. For example, to get the class from class dump it's important to follow the links and collect superclass, superclass of superclass, etc.
Index ¶
- type Class
- type FieldValue
- type Heap
- func (h *Heap) ParseClass(classId core.Identifier) (Class, error)
- func (h *Heap) ParseJavaString(str core.JavaValue) (string, error)
- func (h *Heap) ParseNormalObject(objectId core.Identifier) (NormalObject, error)
- func (h *Heap) ParseObjectArrayFull(arrayObjectId core.Identifier) (ObjectArray, error)
- type InstanceField
- type NormalObject
- type ObjectArray
- type PrimitiveArray
- type StaticField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Class ¶
type Class struct {
Name string
Superclass *Class
StaticFields []StaticField
InstanceFields []InstanceField
}
Class is linked-list of information extracted from HPROF_GC_CLASS_DUMP as well as the Class data of all its superclasses.
type FieldValue ¶
FieldValue is a wrapper returns from NormalObject.GetFieldValueByName. Origin field has the name of the class (or any superclass) that actually defines requested field.
type Heap ¶
type Heap struct {
// contains filtered or unexported fields
}
Heap contains methods for reading data from the heap dump.
func NewHeap ¶
func NewHeap(parsedAccessor *dump.ParsedAccessor) *Heap
func (*Heap) ParseClass ¶
func (h *Heap) ParseClass(classId core.Identifier) (Class, error)
ParseClass parses inforamsion from HPROF_DC_CLASS_DUMP record of a class and all its superclasses.
func (*Heap) ParseJavaString ¶
ParseJavaString takes the instance values known to be a reference to java.lang.String object and converts it to convenient Go string.
func (*Heap) ParseNormalObject ¶
func (h *Heap) ParseNormalObject(objectId core.Identifier) (NormalObject, error)
ParseNormalObject is used to parse NormalObject by given objectId. It also triggers ObjectReader.ParseClass because NormalObject should contain information about class it represents.
func (*Heap) ParseObjectArrayFull ¶
func (h *Heap) ParseObjectArrayFull(arrayObjectId core.Identifier) (ObjectArray, error)
ParseObjectArrayFull reads the whole object array and returns slice with ObjectArray structs
type InstanceField ¶
InstanceField is representation of class'es instance field name and type, obtained from HPROF_GC_CLASS_DUMP
type NormalObject ¶
NormalObject is representation of HPROF_GC_INSTANCE_DUMP. It has corresponding Class. The values of fields are raw bytes. NormalObject.GetFieldValueByName should be used to read particular field value.
func (*NormalObject) GetFieldValueByName ¶
func (o *NormalObject) GetFieldValueByName(name string) (FieldValue, error)
GetFieldValueByName extracts instance field value by name of the field as well as name of the class that actually defines requested field.
type ObjectArray ¶
type ObjectArray struct {
ArrayClassId core.Identifier
Elements []core.Identifier
}
ObjectArray holds type and elements of object array
type PrimitiveArray ¶
PrimitiveArray represents HPROF_GC_PRIM_ARRAY_DUMP but only it's "header" part. To obtain the body, i.e. elements of the array, raw bytes should be read from underlying index.Reader.