https://github.com/forderud/sharedmemmarshal
Sample code for COM marshaling with shared memory
https://github.com/forderud/sharedmemmarshal
com windows
Last synced: 5 months ago
JSON representation
Sample code for COM marshaling with shared memory
- Host: GitHub
- URL: https://github.com/forderud/sharedmemmarshal
- Owner: forderud
- License: mit
- Created: 2018-12-20T07:57:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-18T12:56:23.000Z (11 months ago)
- Last Synced: 2025-04-28T16:18:31.835Z (5 months ago)
- Topics: com, windows
- Language: C++
- Homepage:
- Size: 4.55 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Sample code for custom COM marshaling with shared memory. This pattern **can be used to avoid copying overhead** when passing large amount of data between COM objects in different processes.
## DCOM garbage collector limitation
Associated StackOverflow question: https://stackoverflow.com/questions/69010789/how-to-leverage-dcom-garbage-collector-with-custom-marshaling-imarshal (answered)The DCOM garbage collector usually cleans up leaking stub references after client processes terminate. This automatic garbage collection is unfortunately not available for classes implementing IMarshal. This limitation can be worked around by introducing an extra COM object for maintaining references from the client-side proxy back to the server. This is implemented using a tiny `RefOwner` class that is marshalled using `CoMarshalInterface`/`CoUnmarshalInterface` from the server to the proxy.
## References
* [IMarhal](https://learn.microsoft.com/en-us/windows/win32/api/objidl/nn-objidl-imarshal) interface
* Inside COM+: [Will That Be Custom or Standard Marshaling?](https://thrysoee.dk/InsideCOM+/ch14c.htm) - uses event objects to synchronize destruction from proxy to server.