I am using Visual Studio 2008 and I am encountering a problem with cppunit. The program compiles and runs perfectly fine in debug but in release I am getting the following
"HEAP: Invalid address specified to RtlFreeHeap( 00A80000, 00182448 )
Windows has triggered a breakpoint in CppUnitTestRunner.exe."
Now when tracking through the code it is happening after the following line is called:
This goes into the CPPUNIT_TEST( testAssertThrow ); area, and the error is shown.
Has anyone encountered an error like this before? If so, how do I fix this ? I am on a 64 bit system if that makes any difference.
Thanks for your time,
Gerard you aren't alone :), I think I am hitting the exact same issue.
After runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest()); seems heap will be corrupted if you have more than one test method in the registered test suite.
And I tried on a clean x86 machine with empty VS 2005 project (not 2008), this still repros. Let me know if you need more info, I can provide the project or dump if necessary.
Thanks for any pointers, will be very appreciated…
I poked around and found some leads, but still out of idea how can I get it work.
We are linking the Runtime Libraries as /MT in Release Builds, for all production code and test code, and seems this breaks cppunit.
To prove this, under Debug build, switch Runtime Libraries from /MDd to /MTd, the exact same issue will happen.
This is kind of blocker for all products if they are releasing as /MT?
Please help out…
I think I found the trick. Compliling as MT will cause multiple copy of CRT being hosted in process, so memory allocated in exe will not be able to freed in dll as educated here: http://msdn.microsoft.com/en-us/library/ms235460(v=vs.80).aspx
So because of the nature of cppunit, we cannot build it as dll using MT.
Get this away by static linking cppunit using /MT.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.