func StupidGetMemory(proc *process.Process) (ms *MemoryStat, err error) { ms = &MemoryStat{} memStat, err := proc.MemoryInfoEx() if err != nil { return nil, err } ms.VSS = memStat.VMS ms.RSS = memStat.RSS // PSS from dumpsys appname, _ := proc.Cmdline() cmd := exec.Command("/system/bin/dumpsys", "meminfo", appname) if data, er := cmd.CombinedOutput(); er == nil { res1 := ptn1.FindStringSubmatch(string(data)) if len(res1) != 0 { fmt.Sscanf(res1[1], "%d", &ms.PSS) } else { res2 := ptn2.FindStringSubmatch(string(data)) if len(res2) == 0 { return ms, nil } fmt.Sscanf(res2[1], "%d", &ms.PSS) } ms.PSS <<= 10 } return ms, nil }