Re: STL allocator for shared memory
- From: "Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx>
- Date: Fri, 19 Aug 2005 16:34:54 +0100
Joe wrote:
The problem will be that you have no control over how memory is utilized, and more than likely an STL-allocated object will contain pointers -- when stored in shared memory by the process that created the object these pointer-values will be valid addresses, but not when accessed by other processes. Pointers stored in shared-memory need to be stored as offsets from the base of shared memory.
With Dinkumware's implementation you can use a custom pointer type that contains an offset (using the allocator::pointer typedef). I've had offset pointers working in a container using their implementation, since it is very careful to always use the allocator typedefs rather than assuming that pointer == T*.
Tom .
- Follow-Ups:
- Re: STL allocator for shared memory
- From: Joe
- Re: STL allocator for shared memory
- References:
- STL allocator for shared memory
- From: sutphinwb
- Re: STL allocator for shared memory
- From: Joe
- STL allocator for shared memory
- Prev by Date: Re: Do I need synchronisation for 1 writer, 1 reader thread?
- Next by Date: Re: Multi-thread testing platform
- Previous by thread: Re: STL allocator for shared memory
- Next by thread: Re: STL allocator for shared memory
- Index(es):
Relevant Pages
|