Convex mesh memory leak

I try to release memory at runtime.
Why memory couldn’t be released when i work with convex meshes.

My process:


My deleting process steps:

  1. release all materials
  2. release all shapes
  3. release all actors
  4. release all convex meshes (before invoke release reference count is 1)


I’m doing the same, and have no leaks on PhysX 3.3.
But I do scene.release() after releasing all objects, and CreateScene(scene) before starting simulation again. Try to release scene.

I can’t release scene, because i should have the option to delete x actors (not all) and create as many as i need.

I have 20 vehicles(with many rigidbodys and shapes). All of them have some transport orders and driving in the scene. Then i want delete 10 of them and create x new cars.

I’ve watched my code. I’m releasing convex mesh after coocking. And at the time I don’t need it more, I release actor that the mesh attached.
Like that:

//Cooking was good
	//Creating mesh
	PxToolkit::MemoryInputData input(buf.getData(), buf.getSize());
	PxConvexMesh *convexMesh = pGlobalPhysics->createConvexMesh(input);
	//if mesh was created, assign it to actor
	if (convexMesh)
		pShape = pDynActor->createShape( PxConvexMeshGeometry(convexMesh),*CurrentMaterial,NG2MatToPxTransform(matG));

. . .


Don’t you forget to release that temporary thing?