Heap assertion on startup

Heap assertion on startup

Hello everybody! First, I would like to thank you for providing this great physics package free of charge for students. And now about my problem: I am currently working on my project that consists of an engine and a visual c++ editor. I would like to implement some physics (rigid body simulation at least) in my engine so I downloaded the hk2012_1_0_r1 package and ran the Physics demo (that includes rigid bodies) form the Step by Step demo folder.

Then I tried to setup the havok with the same project settings that are in the Physics demo and the only difference was the CLR support option which was set to /clr in my project. The compilation goes fine with some warning saying that some havok matrix functions will be compiled as native which sounds reasonable. Now when I run my project (the engine and the editor are in the same project) I am getting a Debug Assertion failed assert that kicks off before any of my code is executed (breakpoint in the beginning of the VC++ main). I tried to comment all of the code in my havok wrapper class (except of the includes and undefines) which led to the same error. I can assume that the error comes from initialising some statics inside the havok, but this is just a guess. I am using Visual Studio 2010 SP1 and Windows 7 Ultimate.

Thanks for the assistance,
Stan 

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

Hi Stanislav,

Does the debug assertion failed window provide any other information, such as file name or line number where the assertion is failing? Are you running the application in a Debug configuration? If you hit retry in the debug assertion failed window to start debugging the application, what is in the callstack?

Amy

Amy Developer Support Engineer Havok www.havok.com

Edit: Sorry for the double posting, something went wrong and I did not see the first post.

Hi Amy,

I didn't try to compile it in Release before. I still get a crash, however there is a callstack leading to some dlls. When I compiled in Release, I had to link with release_multithreaded_dll because I was getting Iterator level linker errors. I have attached two screenshots, I thought will be useful.

Attachments: 

AttachmentSize
Download debugcrash.jpg509.42 KB
Download releasecrash.jpg488.39 KB

Hi Stanislav,

Sorry if I confused you, when I asked whether you were running in Debug, I meant you should be :) What is the callstack after hitting retry in Debug configuration?

It looks like this usually down to project settings mixing managed & unmanaged code. Which project settings did you copy for your project? Debug or FullDebug with Multithreaded or Multithreaded DLL? Could you try using each of their settings and see if any of them fixes your problem?

Amy Developer Support Engineer Havok www.havok.com

Hello Amy,

I am sorry I am a bit late with the reply. Yes, I am running it in Debug mode. The callstack is at a generic function used to detect heap corruption. I have attached a screenshot with it. I have tried using both debug multi-threaded dll and full debug multi-threaded dll libraries and I get the same assert. The project I copied the settings from is Demo\StandAloneDemos\StepByStep\Physics. It is console based, but I don't think it should matter. Also, I have noticed that the assert shows even when I have commented the whole physics wrapper class and all that is left is the havok includes and undefines.

Stan 

Attachments: 

AttachmentSize
Download callstack.jpg520.05 KB

Hi Stanislav,

I've tried to reproduce your assert by enabling clr support in the Demo\StandAloneDemos\StepByStep\Physic project. To get it to build I also had to change C/C++ -> Code Generation -> Enable Enhanced Instruction to Not Set. I then got all the warnings you mentioned in your original post but the project still ran fine. Could you try this and see if it works for you? If it does could you compare the project settings to make sure they are the same?

Also, your initial guess about statics being initialised seems to be correct as the application is crashing after trying to initialise a static hkMemoryRouter (two lines down from the highlighted one in your last image). I'm not sure why this is just yet, but I'd like to remove the project settings as a possible cause first.

Amy Developer Support Engineer Havok www.havok.com

Leave a Comment

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