What is up with "Debug Error!" from Microsoft Visual C++ Runtime Library?

What is up with "Debug Error!" from Microsoft Visual C++ Runtime Library?

Does anyone know the root causes of "Debug Error!" from Microsoft Visual C++ Runtime Library that is often accompanied by a message that says "Damage before 0x0... which was allocated by aligned routine"?

I'm getting this error in one of my codes when I run the executable build with Debug configuration for Intel 64 (64-bit) with the /dbglibs setting for Fortran Run-time libraries.  But the executable built with Release configuration runs with no such error.  So I rebuilt the Debug configuration executable with non-debug libraries (i.e., /dbglibs setting removed) and this error disappeared.

However I was not getting such an error in my code earlier, so some of my recent changes must have caused this to happen.  But I can't figure out what.  Note I've unit-tested thoroughly and separately each and every change.  The code is quite proprietary, so I can't post it here.

Hence I would appreciate if anyone has any pointers on what all I can check in my code.

Thanks,

 

 

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Fyi I'd run into a similar problem earlier - mentioned in this forum topic https://software.intel.com/en-us/forums/topic/500781 - and the symptoms now are very similar.  Since the previous report was about a missing "finalizer", I've checked the FINAL bindings on all the Fortran "classes" I'm using and have not discovered any problems with any "finalizer" yet.

I suspect (perhaps this is obvious) that you are seeing the error as a result of the additional checking that the debug runtime library does for memory allocations.  It does things such as setting guard bytes at the head and tail of any memory allocation, that it can use to check for "damage".  There is also support for heap consistency checking in the operating system level library that both the debug and release runtime use, but I think the resulting error messages are different.

The C debug runtime library includes a number of helper routines that you can call from Fortran at various times in your program to try and track down the point at which the apparent heap corruption occurs.  Similar support exists in the operating system runtime.

Fortran bindings for some of the C debug runtime functions attached.  Due to an unfortunate name clash I can't locate the ones for the operating system routines.  Note that these will have been put together on a 32 bit machine and I don't recall ever checking/testing them on 64 bit - though I see I've made some attempt to make things bit generic.  _CrtCheckMemory is the one that might help to scatter around.  You need to be linking to the static debug runtime for these routines to be relevant.

And I might be sending you off on a wild goose chase too...

Attachments: 

AttachmentSize
Download crtmemoryutilities.f9010.24 KB

Thanks very much, Ian - you've given me a lot to think about and try.

Leave a Comment

Please sign in to add a comment. Not a member? Join today