Closed mjzk closed 1 month ago
do we have equvilant API of
windows::Win32::System::ProcessStatus::GetProcessMemoryInfo
?
Now it does, I just implemented it.
if I contribute a single API of
windows::Win32::System::ProcessStatus::GetProcessMemoryInfo
, is it welcome?
Sure.
However, although this API is rather simple, it belongs to PSAPI module, which WinSafe didn't have yet, but I was planning to add. Adding a new module is not exactly simple, so I thought it would be a great opportunity to do so. And so I did.
However, I have no experience with GetProcessMemoryInfo
, so I need your help to test it and see if works correctly. Remember to add the psapi
Cargo feature to your project.
Please report back on this.
if welcome, do I need to depend on the linking to the all or can I use the windows crate?
Not needed.
@rodrigocfd you are so quick! Thanks! I will do some tests recently and report back.
@rodrigocfd This works. for PROCESS_MEMORY_COUNTERS_EX, I only get WorkingSetSize.
Will it be greater if we support virtualSize via VirtualQueryEx? like
...
while (VirtualQueryEx(hProcess, (LPCVOID)address, &mbi, sizeof(mbi))) {
virtualSize += mbi.RegionSize;
address += mbi.RegionSize;
}
@mjzk Please open another issue, so it's easy for me to keep track of it.
@rodrigocfd thanks for feedback. I do a digging on my provided codes. I think there is something wrong with my understanding of Windows process memory usage. The current API is enough. VirtualQueryEx is not for reading memory consumption. Thanks again.
Recently, I contributed to an opensource project, with some Windows APIs like
windows::Win32::System::ProcessStatus::GetProcessMemoryInfo
for reading process's memory stats. But these exposed APIs of windows crate are unsafe, the committer of that project do not likeunsafe
, and suggest me to upstream the change to your repo.I have a look the winsafe sources, it seems we are just linking to the dll directly rather than depending on windows crate. And I do not see much APIs around the system side things.
So, some quick questions:
windows::Win32::System::ProcessStatus::GetProcessMemoryInfo
?windows::Win32::System::ProcessStatus::GetProcessMemoryInfo
, is it welcome?Thanks!