'QSharedMemory mapped file always have zero length

When the QSharedMemory example is running, a mapped file is created into /tmp directory.

$ ls -s /tmp/*Example*
0 /tmp/qipc_sharedmemory_QSharedMemoryExampleff77196351dd7c1c8f79461ad32f21726fe31f5b
0 /tmp/qipc_systemsem_QSharedMemoryExampleff77196351dd7c1c8f79461ad32f21726fe31f5b

All works fine, but the file always have zero length. I tried using setNativeKey() but the result is the same.

When I use shm_open/ftruncate/mmap functions from C, the mapped file have the file size indicate in ftruncate() parameter.

Is this the expected behavior?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source