Memory corruption rant.

Jesse Phillips jessekphillips+D at gmail.com
Tue May 17 16:18:22 PDT 2011


I would love to post a bug with a minimum test case, so that I'd be able to identify if its my fault, the compiler, or libraries I'm using. But at this time I can't seem to reduce it to a reasonable (non-proprietary) portion of code. So for now I'll just rant.

I combining much here. I have two DLL's being loaded. One is Lua, being accessed with LuaD, and the other is a DLL my company has produced. I've been able to get some nice interaction between the three. The company DLL will make function calls which are passed through D into Lua and the result back through D and all this great stuff.

But I've been fighting with delegates and objects disappearing (I think LuaD might not be preserving anonymous delegates, which I can't reproduce in the small). I have some code that has this general flow:

auto myObj = new Object();

// Create lua and company dll objects
// call some functions for lua
// call some functions for company dll
// Other heavy processing with D only (takse > 60 seconds)
//  make a call to company dll (takes > 30 seconds)

writeln("I"m still ok")
writeln(myObject is null); // Crash with access violation

I can remove the last call to the company dll and everything is fine. And this has been working for some time until recently when I changed some stuff on the heavy D processing side (added a struct into the mix).

I'm not even accessing myObject, I'm just asking if it has a value it shouldn't!

In all other respects it has been a blast combining all this.


More information about the Digitalmars-d-learn mailing list