I need to determine the memory page size in C# without using "Kernel32.dll"
SYSTEM_INFO si;
GetSystemInfo(&si);
This is very important because the code should be cross platform and we should not have platform specific code.
Is there any .NET class which provides that data?
The getpagesize() function returns the current page size. The getpagesize() function is equivalent to sysconf(_SC_PAGE_SIZE) and sysconf(_SC_PAGESIZE).
The pagesize command prints the size, in bytes, of a page of memory, as returned by the getpagesize subroutine. Provided for system compatibility, this command is useful when constructing portable shell scripts.
Try Environment.SystemPageSize
:
Gets the number of bytes in the operating system's memory page.
Requires .NET >= 4.0
In the remarks it is even written that:
In Windows, this value is the dwPageSize member in the SYSTEM_INFO structure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With