StlMesh_Mesh destructor very slowly

I figured out that the destructor of a StlMesh_Mesh is very slowly. It takes about one or two minutes till it is finished.

In this thread there is exactly the same problem with another class, but no solution was posted.

Is there a way to make the destructor faster? Why is it so slow at all?


Thorsten H's picture

Hallo Joachim,

I often encountered this issue in "Debug Mode" (Visual Studio). In "Release Mode" the destructor is *much* faster.

Viele Grüße aus Mülheim ;)


Joachim Greiner's picture

Hi Thorsten

Nice surprise to meet you here ;-)

Thanks for your suggestion, but unfortunately switching from Debug mode to Release Mode brings no significant improvement. For an 18MB Mesh the destructor needs almost three minutes untill it is finshed.


Thorsten H's picture

I tested this Code in my app:

OSD_Path fileName = "C:\\Temp\\mesh1.stl";
Handle(StlMesh_Mesh) mesh = RWStl::ReadFile(fileName);
Handle(MeshVS_Mesh) aisMesh = new MeshVS_Mesh();
Handle(XSDRAWSTLVRML_DataSource) datasource = new XSDRAWSTLVRML_DataSource(mesh);
aisMesh->GetDrawer()->SetBoolean(MeshVS_DA_SmoothShading, Standard_True);

Windows 10, OCCT 6.9.0 x64, Visual Studio 2013 Pro

With a 27 MB STL file (binary mode, ~570.000 Triangles) the "nullify"s take something less than one second. Application termination takes ~3 seconds (perhaps this is relevant for delayed destruction of "Handle" encapsuled pointers to mesh objects)

Try this in your environment. If you experience no problems: can you post sample code, which demonstrates your problem?

Joachim Greiner's picture

I simply do it that way:

Handle(StlMesh_Mesh) amesh = RWStl::ReadFile(filename, indicator);

I think the main difference is, that I´m still using OCCT 6.6.0. I will test it with OCCT 6.9. and hope that this will increase the Speed.