is it possible to find out the page size of a processor using C program and malloc?
and not by using sysconf() call?
is it possible to find out the page size of a processor using C
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you can #include some linux kernel header, you can find the macro PAGE_SIZE in
On cygwin (and perhaps windows’ ddk) i’s in
There are “dirty tricks” (very, very dirty!) to calculat the page size at runtime. All unportable and totally system-dependent.
Let’s have some fun!
A possible trick on may systems is to create a shared memory object only 1 byte long. The system call usually rounds the size up to the system page size. Bleach!
Another one, if you are running on unix-like systems and you dare to intercept the SIGSEGV signal, you could try to explore the memory by looking for valid areas and see which power of 2 they are rounded. Uhm…
So, why sysctl is not good for you?
Regards