STL and memory mapping 
Author Message
 STL and memory mapping

Is it possible (in windows) to have an STL container (vector) allocated to
shared memory so that multiple processes could access it? If so, can
someone please point me to articles/sites/etc for reference?

thanks, Brian



Sat, 23 Oct 2004 09:02:03 GMT  
 STL and memory mapping

Hello,

This is an Advanced C++ topic, this is what they say in the msdn, but i
think it is not that hard!! ;-)
What you have to do is write your own allocator (see allocator class in
msdn).
I would sugest deriving it from the allocator class an then overriding the
methods so that allocate
our shared memory, probably, depending of the case you are implementing, you
only need to
override the new operator and the delete operator, and let the base class do
all of the rest.
Then you simply pass our allocator as a second template argument into the
vector and it is all done!!!

You can find something about allocators in the following book,
The C++ Programming Language, B. Stroustrup

Kind Regards
Cludio Albuquerque


Quote:
> Is it possible (in windows) to have an STL container (vector) allocated to
> shared memory so that multiple processes could access it? If so, can
> someone please point me to articles/sites/etc for reference?

> thanks, Brian



Sat, 23 Oct 2004 20:24:52 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. STL, std::allocator and memory mapped files

2. STL custom allocator using memory mapped file

3. an STL map in shared memory

4. Memory leak with stl map ?

5. stl::map - can't map int to char *

6. MFC map or stl map

7. STL Newbie: STL maps

8. Memory-mapped files - pros and cons of mapping view on whole file

9. Dynamic allocate memory size in memory mapping

10. IPC: Shared memory via dll vs memory map file

11. copying CObject-derived-classes to shared memory (created using Memory-Mapped file)

12. stl map

 

 
Powered by phpBB® Forum Software