www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Memory corruption with COM object

reply Rene Zwanenburg <renezwanenburg gmail.com> writes:
I've been staring at this problem the past few hours without 
making any progress. But I feel like I'm overlooking something 

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 

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 

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?
Jul 06 2018
parent Kagamin <spam here.lot> writes:
You can enable logging in GC and see what's allocated and 
Jul 09 2018