Memory corruption with CCD.

PhysX version : 3.3.1

My test case is a little lengthy to post so I’ll try to describe as best what is happening. The scene is composed of several actors 1 triangle mesh, 5 planes, several box shapes and several sphere shapes. All actors have CCD enabled ( small scene so I’m not worried about CCD overhead ). The sphere shaped represent projectiles which are emitted on a regular basis. If the sphere shaped collide with any other object in the scene the app can cleaning shutdown without throwing a memory corruption assertion (debug build ). However, if the 2 spheres collide, then an assertion is thrown at shutdown due to an invalid pointer being deleted. If CCD is not enabled, there is no assertion.

NOTE: I have implemented an allocator that allocated aligned memory using _aligned_malloc/_aligned_free. I’ve also tried a manual alignment scheme, both with the same result. To further convince myself that the issue is not with the allocation, I added allocation tracking in the debug build and the memory address being sent to allocator to be freed is not present in the list of allocated memory.

Been going through the documentation wrt to CCD, memory allocation and nothing has jumped out at me yet. Also I’m using a single simulation thread in my application.