Location of POSIX shared memory on Mac OS

Hi All,


I am using shared memory in my application. On linux POSIX shared memory file is created at /dev/shm, but on Mac OS i am not able to find the /dev/shm. So I have few queries regarding the location of POSIX shared memory on Mac OS:


1. Is POSIX shared memory on Mac OS is stored as file(Just like at /dev/shm on Linux)?If Yes, Which location?

2. How POSIX shared memory implementation on Mac OS is different from Linux?


Thanks & Regards,

Vinay

Mac mini, Mac OS X (10.7)

Posted on Jul 30, 2012 3:10 AM

Reply
1 reply

Jul 30, 2012 6:14 AM in response to vinaykuma

I'm assuming you are using shm_open() and friends, as apposed to mmap(), I have to say I've never used this system call before (only mmap()), but ....


Since shm_open() man page says objects do not exist after a reboot, it is possible the object name only exist in the kernel and the address space when not in RAM is kept in the pagefiles along with all other virtual memory pushed to disk.


But it could also be stored somewhere under /var (such as /var/vm, but also /var/run, or any place else under /var). All guessing on my part.


You could create an object with a specific name, then use the 'find' command to search the file system for that named object and discover whether Mac OS X uses the file system name space to store shm_open() objects, or if it is just an anonymous object maintained by the currently running kernel.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Location of POSIX shared memory on Mac OS

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.