E.g. if the object containers other allocations (strings, dynamic arrays) you must take very special case that those are also in the shared memory space.
My idea was that such a mechanism could operate like this:
1. Process 1 starts and creates the shared memory SH
2. Like is now, Process 1 has a the default memory manager so that if one ask a memory allocation, the standard process memory is used
3. Process 1 has also another memory manager associated to SH
4. In some way it should be possible to use for one allocation the second mem manager, and this means that all the allocations triggered by the master allocation reside in SH
5. All further reallocations also have to live in SH (mmm this seems kinda complex)
6. SH is accessed by Process 2
7. Also Process 2 has an extra mem manager associated to SH
8. Pointer obtained from 4 is given to Process 2
9. Again also any reallocation made by Process 2 via the extra mem manager must guaranteed that this shared object entirely lives in SH
I don't really know if this is somehow possible...