shirou / gopsutil

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

windows's swap mem wrong #1511

Closed chenjie199234 closed 1 month ago

chenjie199234 commented 1 year ago

gopsutil version:v3.23.7 I set the swap mem to 0 on windwos But,when i use mem.SwapMemory() to get the info,there is still data return. 1 2

uubulb commented 2 months ago

Same here Hopefully this will get some attention.

https://github.com/shirou/gopsutil/blob/dab07a32fa6a50ac4ae279b32868e284d821aaef/mem/mem_windows.go#L86-L88

I searched the document here, maybe CommitLimit multiplied by PageSize represents the total memory instead of the swap memory?

shirou commented 1 month ago

psutil usesPaging File(_Total)\\% Usage via Performance Counter and then calculating the amount. I think this is the way gopsutil should be done.