cmd:go tool pprof -alloc_objects main.test memprofile.out
File: main.test
Type: alloc_objects
Time: Aug 16, 2023 at 4:33pm (CST)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof) top
Showing nodes accounting for 17323653, 99.81% of 17356430 total
Dropped 1 node (cum \<= 86782)
Showing top 10 nodes out of 15
flat flat% sum% cum cum%
14374456 82.82% 82.82% 14374456 82.82% awdb.(*awdbReader).readDecode
1048624 6.04% 88.86% 1966142 11.33% strconv.syntaxError (inline)
983055 5.66% 94.52% 983055 5.66% net.IPv4 (inline)
917518 5.29% 99.81% 917518 5.29% strconv.cloneString (inline)
(pprof) list readDecode
Total: 17356430
ROUTINE ======================== awdb-go/awdb.(awdbReader).readDecode in /root/workspace/*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/xxx/main.go
14374456 40982478 (flat, cum) 236.12% of Total
. . 209:func (r \*awdbReader) readDecode(offset uint) (interface{}, uint, error) {
. . 210: dataType := intTypeData(r.buffer\[offset\])
. . 211: newOffset := offset + 1
. . 212: switch dataType {
. . 213: case \_Arrary:
1070445 14374456 214: return r.awDecodeArrary(newOffset)
. . 215: case \_Pointer:
. 13304011 216: return r.awDecodePointer(newOffset)
. . 217: case \_String:
13304011 13304011 218: return r.awDecodeString(newOffset)
. . 219: case \_LongString:
. . 220: return r.awDecodeLString(newOffset)
. . 221: case \_Uint:
. . 222: return r.awDecodeUint(newOffset)
. . 223: case \_Int:
(pprof) list awDecodeString
no matches found for regexp: awDecodeString
(pprof)
Calling relation:awDecodeArrary->awDecodePointer->awDecodeString
'list awDecodeString' output the memory usage is displayed