forderud / ComSamples

Examples of language-neutral COM interfaces for IPC and language interop.
MIT License
1 stars 2 forks source link

Investigate MyClientCs ref-leak #11

Closed forderud closed 1 year ago

forderud commented 1 year ago

Observed problem: COM Release calls does for not seem to propagate from MyClientCs to MyServer. this leads to ComClass.m_obj_cnt == 2 when the client terminates.

Adding GC.Collect(); client-side does not seem to work.

Leaking references

var server = new MyInterfaces.MyServerClass(); var cruncher = server.GetNumberCruncher();

Possible approach

// Activate fast stub rundown after app crashes. Reduces the cleanup delay from ~11min to <10sec
CComPtr<IGlobalOptions> globalOptions;
CHECK(globalOptions.CoCreateInstance(CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER));
CHECK(globalOptions->Set(COMGLB_RO_SETTINGS, COMGLB_FAST_RUNDOWN));
forderud commented 1 year ago

Fixed in 5e187f5cd1becd0eead1a3a459c9a88f1967d95f