Merge pull request #898 from tyldavis/master

Fix MemoryMaps on ARM
This commit is contained in:
shirou 2020-07-24 12:39:17 +09:00 committed by GitHub
commit efc768ada6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -577,6 +577,7 @@ func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]M
continue
}
v := strings.Trim(field[1], "kB") // remove last "kB"
v = strings.TrimSpace(v)
t, err := strconv.ParseUint(v, 10, 64)
if err != nil {
return m, err
@ -610,11 +611,11 @@ func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]M
blocks := make([]string, 16)
for _, line := range lines {
field := strings.Split(line, " ")
if strings.HasSuffix(field[0], ":") == false {
fields := strings.Fields(line)
if len(fields) > 0 && !strings.HasSuffix(fields[0], ":") {
// new block section
if len(blocks) > 0 {
g, err := getBlock(field, blocks)
g, err := getBlock(fields, blocks)
if err != nil {
return &ret, err
}