#include <unistd.h>
(size_t) sysconf(_SC_PAGESIZE);
sysconf(_SC_PAGESIZE) tells me that my memory page size is 4096 on my operating system and processor. Of the 4096 bytes in the memory page, how many can be used for data and how much is overhead/metadata?
I have an application where I am optimizing cache locality by packing frequently accessed pointers into the same cache block and need to know if the whole memory page is usable, or if I will go over memory page boundaries by filling the whole memory page.