If you open and mmap() a regular file, data will end up in that file.
If you just need to share a memory region, without the need to persist the data, which incurs extra I/O overhead, use shm_open().
Such a memory region would also allow you to store other kinds of objects such as mutexes or semaphores, which you can’t store in a mmap()’ed regular file on most systems.