On 1/13/20 4:34 AM, Per Nordlöw wrote:
On Sunday, 12 January 2020 at 17:36:23 UTC, Adam D. Ruppe wrote:
Of course that doesn't help the case when you don't know the rule and don't even think to call it.......

Thanks. I checked and @nogc-qualified all the class destructors defined in my project. Without finding any potential problems. Any other suggestions on how to trace this problem?

Finding where this is happening is a really difficult problem. Not only because there is no stack trace (I believe this is because the invalid memory operation error cannot allocate any GC memory, and there are very small parts of the stack trace printing code that allocate), but because it is invariably happening inside a GC collection -- so the error is far away from where you allocated (sometimes the conditions that trigger the dtor to allocate are hard to figure out from looking at the object when it's destroyed).

I actually had a problem in my vibe.d code where the error didn't display until the system was shutting down. Figuring out where it was involved defining the extern(C) function onInvalidMemoryOperationError (I think if you define this in your code, it overrides the runtime library's version), so I could do some diagnostics, and set a breakpoint.

Try starting there and see if you can find why the IMO is happening.

https://github.com/dlang/druntime/blob/c85dea29cb721ec76af6793076aa93e2f62a23da/src/core/exception.d#L535

-Steve

Reply via email to