Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust] types of SetProcessWorkingSetSize's parameters should be isize, instead of usizfe #1998

Open
csmoe opened this issue Sep 13, 2024 · 2 comments

Comments

@csmoe
Copy link

csmoe commented Sep 13, 2024

See https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-setprocessworkingsetsize the parameters can be -1

If both dwMinimumWorkingSetSize and dwMaximumWorkingSetSize have the value (SIZE_T)–1, the function removes as many pages as possible from the working set of the specified process.

microsoft/windows-rs#3281

@riverar
Copy link
Collaborator

riverar commented Sep 13, 2024

SIZE_T is a ULONG_PTR, emphasis on unsigned, so is not likely to get changed here. Just an unfortunate API design. But will leave this open if folks want to do something to improve the situation here.

@csmoe
Copy link
Author

csmoe commented Sep 14, 2024

For others encountering this, here's a workaround: pass usize::MAX to this function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants