{"id":25416389,"url":"https://github.com/forderud/sharedmemmarshal","last_synced_at":"2026-02-02T05:06:02.951Z","repository":{"id":37943550,"uuid":"162545897","full_name":"forderud/SharedMemMarshal","owner":"forderud","description":"Sample code for COM marshaling with shared memory","archived":false,"fork":false,"pushed_at":"2025-12-04T16:51:35.000Z","size":4893,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-07T03:33:11.494Z","etag":null,"topics":["com","windows"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/forderud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-12-20T07:57:47.000Z","updated_at":"2025-12-04T16:51:39.000Z","dependencies_parsed_at":"2024-05-28T01:09:04.736Z","dependency_job_id":"70b94df9-5e86-4b5e-ac74-ccf695427f57","html_url":"https://github.com/forderud/SharedMemMarshal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/forderud/SharedMemMarshal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FSharedMemMarshal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FSharedMemMarshal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FSharedMemMarshal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FSharedMemMarshal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forderud","download_url":"https://codeload.github.com/forderud/SharedMemMarshal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FSharedMemMarshal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29006081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T04:25:24.522Z","status":"ssl_error","status_checked_at":"2026-02-02T04:24:51.069Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["com","windows"],"created_at":"2025-02-16T16:54:54.814Z","updated_at":"2026-02-02T05:06:02.946Z","avatar_url":"https://github.com/forderud.png","language":"C++","readme":"Sample code for custom COM marshaling with shared memory. This pattern can be used for **zero-copy exchange of large buffers between processes**. The implementation is _transparent_, meaning that clients doesn't notice that the COM `SAFEARRAY` buffers reside in shared memory.\n\n### Overview\n\u003c!-- Use https://boxy-svg.com/ to edit the SVG --\u003e\n![Overview](Overview.svg)\n\n| Project          | Description |\n|------------------|-------------|\n| `ImageSource`    | COM _server_ EXE that exposes image-data. |\n|`ImageSourceProxy`| COM _proxy_ DLL that is automatically loaded into the client process to facilitate custom marshaling. This is fully _transparent_ without the client process' awareness. |\n| `ImageClientCpp` | Sample C++ command-line project for accessing image-data that happens to be stored in shared memory. |\n| `ImageClientCs`  | Sample C# command-line project for accessing image-data that happens to be stored in shared memory. |\n| `UnitTests`      | Unit-test project. |\n\n### Getting started\n#### Instuctions\n* Start Visual Studio with admin privileges.\n* Open `SharedMemMarshal.sln` solution.\n* Build all projects.\n* Start `ImageClientCpp` or `ImageClientCs` project.\n* Observe that the client project is able to access image-data exposed by the `ImageSource` process without any copying.\n\n#### Cleanup\nRun `UNREGISTER_ALL.bat` with admin privileges to clean up all registry entries.\n\n### DCOM garbage collector note\nAssociated StackOverflow question: [How to leverage DCOM garbage collector with custom marshaling? (IMarshal)](https://stackoverflow.com/questions/69010789/how-to-leverage-dcom-garbage-collector-with-custom-marshaling-imarshal) (answered)\n\nThe 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 `RefOwner` class that is marshalled using `CoMarshalInterface`/`CoUnmarshalInterface` from the server to the proxy.\n\n### Links\n* [IMarhal](https://learn.microsoft.com/en-us/windows/win32/api/objidl/nn-objidl-imarshal) interface\n* 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.\n* .Net [unmanaged memory leak when c# get data from COM component](https://github.com/dotnet/runtime/issues/121291) issue (resolved).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforderud%2Fsharedmemmarshal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforderud%2Fsharedmemmarshal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforderud%2Fsharedmemmarshal/lists"}