It's me again, after some time. It's great you keep working on Newton!
I haven't updated newton since approx. 2.24. But today, I encountered a problem with microsoft's crt heapvalidation functionality in debug compile. It tells me after program completion that something on the heap is corrupt, it found a bad node. I also noticed before that my application crashed when running in release for some time and had no clue what the reason could be. So I checked the docu about the heapvalidation and I found out that I can put _heapchk() anywhere in my code and I checks if the heap is still valid. So I put it at various placed in my code to locate where an when that happens. I found out it always happens exactly after 304 iterations of my main loop, newtonupdate gets called once per mainloop. Everything is deterministic. So I can reproduce it.
Now, the location where the heap gets a bad node is always exactly after the NewtonUpdate call:
- Code: Select all
_heapchk();
printf("NewtonUpdate start\n");
NewtonUpdate(newtonworld, 0.016666f);
printf("NewtonUpdate end\n");
_heapchk();
I also added _heapchk() at the beginning and end of all newton callbacks I have => heap is ok there. So it seems as if something happens after NewtonUpdate called all callbacks and before it returns to the caller. As I said, it happens after the 304th iteration/call to NewtonUpdate, so most of the time, things go right and just in some circumstance, things go wrong. As a consequence, I decided to update to the current 2.30 version. But the result is the same. Exactly after the 304th iteration at the same place, the _heakchk() fails.
Do you have an idea what could cause this?
I had to change some calls to newton functions in order to make it work with newton 2.30: I call NewtonWorldGetVersion() somewhere at the beginning, back then it needed the newtonworld as a parameter, but I had to remove it. I also added the identity matrix to all my NewtonCreateBody calls as 3rd parameter.
My scene consists of a UserMeshCollision which I provide my own RayHitCallback as well as my own CollideCallback. The rest of the scene are spheres with a upvectorjoint moving around, with 2 different ForceAndTorque-Callbacks.
I saw you mentioned some trouble with vs2010. I'm currently using that right now. What issues did you have with it? Maybe it's related to this somehow?