X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FPoly%2FPoly_Connect.cxx;h=f1200515c8cad9af70e553e8b28227128b518012;hb=8f08e231fa088f7a0a57a3ae143884bb3228fe41;hpb=f0ada3e8d443fd00d0f6d663868abcd8fb443d4a;ds=inline diff --git a/src/Poly/Poly_Connect.cxx b/src/Poly/Poly_Connect.cxx index 14a8bf747d..f1200515c8 100644 --- a/src/Poly/Poly_Connect.cxx +++ b/src/Poly/Poly_Connect.cxx @@ -16,6 +16,7 @@ #include +#include #include #include @@ -23,9 +24,9 @@ struct polyedge { polyedge* next; // the next edge in the list - Standard_Integer nd; // the second node of the edge Standard_Integer nt[2]; // the two adjacent triangles Standard_Integer nn[2]; // the two adjacent nodes + Standard_Integer nd; // the second node of the edge DEFINE_STANDARD_ALLOC }; @@ -97,6 +98,8 @@ void Poly_Connect::Load (const Handle(Poly_Triangulation)& theTriangulation) // create an array to store the edges starting from the vertices NCollection_Array1 anEdges (1, aNbNodes); anEdges.Init (NULL); + // use incremental allocator for small allocations + Handle(NCollection_IncAllocator) anIncAlloc = new NCollection_IncAllocator(); // loop on the triangles NCollection_Vec3 aTriNodes; @@ -144,7 +147,7 @@ void Poly_Connect::Load (const Handle(Poly_Triangulation)& theTriangulation) if (ced == NULL) { // create the edge if not found - ced = new polyedge(); + ced = (polyedge* )anIncAlloc->Allocate (sizeof(polyedge)); ced->next = anEdges[anEdgeNodes[0]]; anEdges[anEdgeNodes[0]] = ced; ced->nd = anEdgeNodes[1]; @@ -196,16 +199,16 @@ void Poly_Connect::Load (const Handle(Poly_Triangulation)& theTriangulation) anAdjIndex += 3; } - // destroy the edges array - for (Standard_Integer aNodeIter = anEdges.Lower(); aNodeIter <= anEdges.Upper(); ++aNodeIter) + // destroy the edges array - can be skipped when using NCollection_IncAllocator + /*for (Standard_Integer aNodeIter = anEdges.Lower(); aNodeIter <= anEdges.Upper(); ++aNodeIter) { for (polyedge* anEdgeIter = anEdges[aNodeIter]; anEdgeIter != NULL;) { polyedge* aTmp = anEdgeIter->next; - delete anEdgeIter; + anIncAlloc->Free (anEdgeIter); anEdgeIter = aTmp; } - } + }*/ } //=======================================================================