When I create a new boost::interprocess::managed_shared_memory, I can see a file appear in C:\ProgramData\boost_interprocess\1571641094\NAME_OF_SHARED_MEMORY which size seems to match that of the shared memory created.
My understanding from the documention is that there are two widely used objects usable to share memory between processes (within managed_shared_memory's scope):
- basic_managed_shared_memory
- basic_managed_mapped_file
The managed_shared_memory uses the basic_managed_shared_memory implementation. I assumed this implementation is proper shared memory and not a memory mapped file.
Seeing that it uses a file puzzles me. Are both of these managed shared memory based on a memory mapped file implementation ?
Is the only boost shared memory solution on Windows that avoids memory mapped files the windows_shared_memory ?
NB : I am on Windows 10, using VC++ on VS2013.
Code sample that can reproduce the behaviour of creating a file in ProgramData when using a managed_shared_memory :
#include <boost/interprocess/managed_shared_memory.hpp>
int main(int argc, char *argv[])
{
boost::interprocess::permissions permissions;
permissions.set_unrestricted();
boost::interprocess::managed_shared_memory* sharedMemory;
sharedMemory = new boost::interprocess::managed_shared_memory(
{
boost::interprocess::open_or_create,
"NAME_OF_SHARED_MEMORY",
400000,
0,
permissions
}
);
return 0;
}