boost - Shared memory alignment in C++ -
is there alignment allocated shared memory? if yes, operating system?
for example, allocating shared memory in boost:
boost::interprocess::shared_memory_object* segment = new boost::interprocess::shared_memory_object( boost::interprocess::create_only, "name", boost::interprocess::read_write); segment->truncate(10000);
the shared/virtual memory system allocates , maps memory pages , aligned page size. see list of pages sizes here. page size cpu , os specific. not aware of modern cpus use page sizes smaller 4kb.
on posix system can find out page size using sysconf(_sc_pagesize)
. in case when huge pages in use, call returns smallest page size.
Comments
Post a Comment