shirou / gopsutil

psutil for golang
Other
10.56k stars 1.58k forks source link

Process.MemoryInfo provide the wrong Swap value #1012

Closed Karmenzind closed 3 years ago

Karmenzind commented 3 years ago

The doc https://godoc.org/github.com/shirou/gopsutil/v3/process#Process.MemoryInfo said this function will return Swap value.

This function invoked fillFromStatmWithContext https://github.com/shirou/gopsutil/blob/478eb4c76adf46eb175d1c729e25d0993ee418f3/process/process_linux.go#L735 and this method didn't collect the Swap value after initialization so it will always be zero.

Please at least delete the "Swap" from the doc because this bug exists from a long time ago.

shirou commented 3 years ago

Thank you so much! You are correct, it does not return Swap information.

And psutil removes memory_info_ex and adds memory_full_info. We should align those but not scheduled yet.