SAPIEN
SAPIEN copied to clipboard
Allow clearing PhysX mesh cache or creating convex meshes from numpy arrays
Is your feature request related to a problem? Please describe.
Yes. PhysxCollisionShapeConvexMesh::LoadMultiple uses MeshManager to cache PhysX meshes by filename and never invalidates them (see src/physx/collision_shape.cpp and src/physx/mesh_manager.cpp).
In a long-running process this causes:
- Modified meshes with the same filename cannot be reloaded (old cooked mesh is always reused).
- Memory usage keeps growing as more mesh files are loaded and only drops when the engine/process exits.
Describe the solution you'd like Either:
- an API to clear or disable the PhysX mesh cache (C++ and/or Python, e.g.
engine.clear_mesh_cache()), or - an API to build convex collision shapes directly from numpy
vertices/facesarrays, bypassing filename-based caching.
Describe alternatives you've considered
- Changing the filename each time the mesh changes (works around reload, but makes memory growth even worse).
- Restarting the whole process/engine to release cached meshes.
Both are impractical for long-running services or RL training.
Additional context
Python call site: sapien.physx.PhysxCollisionShapeConvexMesh.load_multiple(...).