If you are just using Windows, you can use the following C snippet to get the page size:
#include <stdio.h> #include <windows.h> int main(void) { SYSTEM_INFO si; GetSystemInfo(&si); printf("The page size for this system is %u bytes.\n", si.dwPageSize); return 0; }
(from: http://en.wikipedia.org/wiki/Page_%28computer_memory%29#Windows-based_operating_systems)
On Linux you can find the page size by getting the PAGESIZE configuration parameter from the kernel:
mtak@frisbee:~$ getconf PAGESIZE 4096
(or you can use the getpagesize()
system call).