I know this is weird, but I just have fun.
I am trying to pass std::map (created using the placement of a new one in a fixed area of ββmemory) between two processes through a socket between two machines: Master and Slave . The map I use has this typedef :
The PageTableAllocator<T> class is responsible for allocating any memory that may / need STL containers to a fixed location in memory. For example, all Page objects and internal STL structures are created in this fixed memory area. This ensures that both the std::map object and the allocator are placed in a fixed area of ββmemory. I used GDB to make sure that the card and allocator behave correctly (all used memory is in a fixed area, nothing happens in the normal application heap).
Assuming Master starts up, initializes all its STL structures and a special memory area, the following happens. Slave launches, prints its version of the page table, then searches for Master . Slave finds the master, deletes its version of the page table, copies the Master version of the page table (and the special memory area), and successfully prints its version of the Master page table. From what I did in GDB, I can perform many read-only operations.
When trying to add errors to the newly copied PageTableType Slave object in the allocator void construct (pointer p, const T& value) method. The value passed as p indicates the already allocated memory area (according to the version of Master std::map ).
I donβt know anything about the structure of C ++ objects, but I assume that the state of the object from the Slave version of PageTableType should be freezing even after I replaced all the memory with PageTableType and its allocator is used. My question is that this is a serious problem. Does C ++ support some kind of state of the object outside of the memory area that the object instantiates din?
All objects used on the map are not PODs. The same is true for the dispenser.
source share