Memory Corruption Issue??

Bottled Gin via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 6 23:50:46 PST 2016


Greetings

I am using my D code as a dynamically loadable library that gets 
loaded at run time into C/C++ world. As discussed earlier on this 
thread, the GC does not mark TLS objects in this scenario and as 
a result the GC ends up collecting TLS objects even though these 
objects are still in use. More details of the issue can be found 
on the bug tracker https://issues.dlang.org/show_bug.cgi?id=15513

@Daniel provided two workarounds to this issue. One was to 
disable the GC altogether. I do not want to do that since my 
application generates too much data that necessitates regular 
sweeping.

The other suggested workaround was to explicitly invoke 
GC.addRoot for all the TLS objects. This worked for me for some 
situations, but in other scenarios I am still facing crashes. I 
think these crashes may be resulting from the invisible TLS 
objects in phobos and druntime etc. I have confirmed that all 
these crashes subside if I disable GC altogether and also that 
the crashes do not happen if I make a D bases executable instead 
of DLL.

I want to know if someone is working on this issue. If no one is, 
I am ready to spend time and get this behind me. Actually I have 
already worked on this bug and I think now I have a fair idea of 
what is happening.

Is it the right forum to discuss my findings, or should I put my 
comments on bugzilla. I need some guidance in finding the right 
fix.

Regards
- Puneet



More information about the Digitalmars-d mailing list