Interprocess : appending data

Hello, I create a shared_memory_object, truncate it to set its size, and then create a mapped_region. I would like to know it would be possible to append new data, by applying a new truncation. Also, is it possible to have a second name pointing in the same memory, but with an offset ? Thanks.

El 06/05/2013 18:10, Oodini escribió:
Hello,
I create a shared_memory_object, truncate it to set its size, and then create a mapped_region.
I would like to know it would be possible to append new data, by applying a new truncation.
Yes, if the underlying OS supports it (I think both Windows and POSIX guarantee this.
Also, is it possible to have a second name pointing in the same memory, but with an offset ?
Not a shared_memory_object (a shm object is similar to a file descriptor), but you can have a mapped_region pointing to the same memory starting in a different offset (mapped region always maps whole pages so you might end consuming a bit more memory than needed if the offset is not multiple of page size, but get_address() will return the address resulting from base address + the offset you specified). Best, Ion

Yes, if the underlying OS supports it (I think both Windows and POSIX guarantee this.
And how do I do that ? I just apply a new truncate with the wished extra memory ? I am on Windows.
you can have a mapped_region pointing to the same memory starting in a different offset
OK, thanks.
I read in the doc that offset_ptr must be used to emulate a raw pointer.
But I would need a pointer to point.
Is it possible to declare a variable as
offset_ptr
participants (2)
-
Ion Gaztañaga
-
Oodini