Take the 2-minute tour ×

On Linux, for each process, I can check /proc/PID/statm file.

It's numbers contain values of:

  • Total program size, in kilobytes
  • Size of memory portions, in kilobytes ??????
  • Number of pages that are shared

Which is great, but how do I know how much is a page?

share|improve this question

3 Answers 3

up vote 0 down vote accepted

I'm not a Linux god (by any means) but typically page sizes are 4Kb. There's a pagesize command that should tell you what it is set to on your system. This gives the output of the getpagesize() function.

share|improve this answer
Actually, there is only the POSIX getpagesize() function. I am not aware of a pagesize command on Linux. –  wzzrd Jan 5 '10 at 19:31
Yeah, function (not method). Thanks. Brain on auto there. Thought I remembered a pagesize command somewhere... Maybe was on Solaris or HP-UX... –  squillman Jan 5 '10 at 19:35
Thanks, wrote "program" : #include <stdio.h> void main(){printf("%d\n",getpagesize());} and it returned 4096. thank you. –  user13185 Jan 5 '10 at 20:30
Really? You could have saved yourself some trouble there. If you're not on something other that your average Intel / AMD machine, it's always the same... –  wzzrd Jan 5 '10 at 21:20
@wzzrd - I feel really bad about assuming something that "happens on average, usually, nearly always". –  user13185 Jan 6 '10 at 10:44

99% of the time a page is 4096 bytes.

share|improve this answer

On most common hardware (like AMD64 and i386), a memory page is 4 kilobytes. If I remember correctly, Sparc and some other architectures can do bigger pages, like 8kb.

share|improve this answer

Your Answer

