Memory corruption with COM object

Rene Zwanenburg renezwanenburg at gmail.com
Fri Jul 6 19:41:05 UTC 2018


I've been staring at this problem the past few hours without 
making any progress. But I feel like I'm overlooking something 
obvious..

Using Adam's comhelpers, I've made a JSON plugin for LogParser. 
However after running for a bit it'll crash with signs of memory 
corruption.

My guess was the GC was collecting things still in use, and 
disabling the GC does indeed 'fix' the problem. Looking through 
comhelpers, the code doesn't add a GC root for a created object 
before handing it off to the C side. I've added root adding and 
removing, expecting that to fix the problem. However it didn't 
help.

The DLL uses the helper functions like dll_process_attach in 
DllMain, so druntime is initialized.

What would be a good way to figure out why the GC decides to 
collect objects I'm still holding on to?


More information about the Digitalmars-d-learn mailing list