mirror of
https://github.com/jimeh/rbheap.git
synced 2026-02-19 04:46:40 +00:00
Rename HeapDump to ObjectDump
This commit is contained in:
6
main.go
6
main.go
@@ -55,14 +55,14 @@ func logMsg(msg string) {
|
||||
}
|
||||
}
|
||||
|
||||
func loadDump(filePath string) (*HeapDump, error) {
|
||||
func loadDump(filePath string) (*ObjectDump, error) {
|
||||
logMsg(fmt.Sprintf("--> Loading %s...", filePath))
|
||||
dump, err := NewHeapDump(filePath)
|
||||
dump, err := NewObjectDump(filePath)
|
||||
logMsg(fmt.Sprintf(" Loaded %d addresses", len(dump.Index)))
|
||||
return dump, err
|
||||
}
|
||||
|
||||
func printHexDiff(leaked *[]string, dump *HeapDump) {
|
||||
func printHexDiff(leaked *[]string, dump *ObjectDump) {
|
||||
for _, index := range *leaked {
|
||||
if entry, ok := dump.Entries[index]; ok {
|
||||
fmt.Println(entry.Object.Address)
|
||||
|
||||
@@ -8,21 +8,21 @@ import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
func NewHeapDump(file string) (*HeapDump, error) {
|
||||
heapDump := HeapDump{File: file}
|
||||
func NewObjectDump(file string) (*ObjectDump, error) {
|
||||
heapDump := ObjectDump{File: file}
|
||||
err := heapDump.Process()
|
||||
return &heapDump, err
|
||||
}
|
||||
|
||||
// HeapDump contains all relevant data for a single heap dump.
|
||||
type HeapDump struct {
|
||||
// ObjectDump contains all relevant data for a single heap dump.
|
||||
type ObjectDump struct {
|
||||
File string
|
||||
Index []string
|
||||
Entries map[string]*Entry
|
||||
}
|
||||
|
||||
// Process processes the heap dump
|
||||
func (s *HeapDump) Process() error {
|
||||
func (s *ObjectDump) Process() error {
|
||||
file, err := os.Open(s.File)
|
||||
defer file.Close()
|
||||
|
||||
@@ -56,7 +56,7 @@ func (s *HeapDump) Process() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *HeapDump) PrintMatchingJSON(indexes *[]string) error {
|
||||
func (s *ObjectDump) PrintMatchingJSON(indexes *[]string) error {
|
||||
file, err := os.Open(s.File)
|
||||
defer file.Close()
|
||||
|
||||
@@ -88,7 +88,7 @@ func (s *HeapDump) PrintMatchingJSON(indexes *[]string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *HeapDump) matchingOffsets(indexes *[]string) []int64 {
|
||||
func (s *ObjectDump) matchingOffsets(indexes *[]string) []int64 {
|
||||
var offsets []int64
|
||||
|
||||
for _, index := range *indexes {
|
||||
Reference in New Issue
Block a user