|
Boost Users : |
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-01-24 12:41:39
Wolfgang Hottgenroth wrote:
> Hi,
>
>
> first of all: many thanks to Ion, it was very helpful.
>
> But here is my next problem: Can I and how can I increase the size of a
> shared memory segment?
You can't do that with current Interprocess functions. Maybe I should
add that as a new to-do. There are two difficulties:
-> Should we maintain the base address?
-> What if extending fails? Should I preserve the old shared memory?
-> Should the expansion be atomic? (And this maybe can't be achieved,
because another process can be doing something in the segment and we
have no locks to stop it)
I will think about it when I have a bit of time. But I'm afraid it will
take some time. If you know the objects your shared memory contains, you
can create a new managed_shared_memory and create a new map taking the
old map as an argument. Something like:
managed_shared_memory new_shm(...);
new_shm.construct<MyMap>("name")(old_map);
This would reproduce the old map in the new map. On the other hand, you
will need to notify other processes about this. Shared memory is fixed
size and I'm afraid we can't do much to improve this... I've tried to
experiment a bit with multi-segment shared memory (mapping more shared
memory when needed) but the problem is that somehow other processes must
be notified atomically. And I have no solution for this.
So I'm afraid I have no solution for a dynamically growable shared
memory ;-(
Regards,
Ion
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net