Windows: problem closing 32-bit consolle application

147 Views Asked by At

I am working on an application that when compiled in debug mode for Win32 (on a x64 machine), just before exiting, throws this exception:

Error shown on application termination

From what I was able to reconstruct, it seems that the offending line of code is this, in the xmemroy0.h header:

// If the following asserts, it likely means that we are performing
// an aligned delete on memory coming from an unaligned allocation.
_STL_ASSERT(_Ptr_user[-2] == _Big_allocation_sentinel, "invalid argument");

It seems that this happens when a dll of mine (which is part of the application) is unloaded by the SO. It doesn't seem to be a directly a problem of my software, but I fear I could be the indirect cause of the problem by not handling correctly the dll boilerplate code. For example I am doing nothing special to handle attachments/detachments in the dll. What seems wired to me is that the x64 version seems to work just fine.

Any clue from a senior system programmer that could point me in the right direction would be highly appreciated. I don't really know how to debug this, I am not an expert of the Windows internals.

Sincerely,

0

There are 0 best solutions below