mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
0027490: BRepMesh: Reduce number of memory allocations
1) Reduce the number of calls to malloc by grouping requests to larger blocks. To achieve this goal, the following ways are used: - Containers of types sequence, list and map are initialized with an instance of NCollection_IncAllocator, at this taking care of the time of life of allocated objects, so that not to occupy huge amount of memory. - Allocation of several arrays having the same and short life time is changed so that to allocate a buffer array of necessary size and to place arrays in this buffer. 2) In BRepMesh_FastDiscretFace, optimize the function filterParameters so that to avoid excess memory allocations. 3) In NCollection_CellFilter, change declaration of the method Reset to accept array by reference rather than by value. 4) Add Allocator() method in map, sequence and vector collection classes by analogy with list collection. 5) Correct the size of block for IncAllocator for x64 platform. In order free-ed block to be returned to the system its size should be at least 1024K on x64 and 512K on x86. This allows to retain free virtual space almost to the state before algorithm run. 6) Decrease amount of memory zeroed by calloc. For that, reduce theIncrement parameter of the embedded vectors of the classes NCollection_UBTreeFiller and BRepMesh_VertexInspector to default value 256. 7) Avoid computing bounding box when not necessary (if no relative deflection is used) 8) Cycles by wires of face using TopExp_Explorer are converted to use TopoDS_Iterator instead. 9) BRepMesh_FastDiscret::Add optimized to avoid storing sequences of faces and edges 10) The tests "mesh standard_* W7" are corrected to accept the new behavior. Earlier the following error took place: Not connected mesh inside face 9 {12 13} Now this error was replaced with another one: free nodes (in pairs: face / node): {9 12} Actually it is not a regression, rather improvement, if we look at the snapshot. 11) Change other test cases to their actual state.
This commit is contained in:
@@ -846,16 +846,19 @@ Standard_Integer Adaptor3d_CurveOnSurface::NbIntervals (const GeomAbs_Shape S) c
|
||||
Standard_Integer nu,nv,nc;
|
||||
nu=mySurface->NbUIntervals(S);
|
||||
nv=mySurface->NbVIntervals(S);
|
||||
nc=myCurve->NbIntervals(S);
|
||||
|
||||
// Allocate the memory for arrays TabU, TabV, TabC only once using the buffer TabBuf.
|
||||
TColStd_Array1OfReal TabBuf(1, nu + nv + nc + 3);
|
||||
TColStd_Array1OfReal TabU(TabBuf(1), 1, nu+1);
|
||||
TColStd_Array1OfReal TabV(TabBuf(nu + 2), 1, nv+1);
|
||||
TColStd_Array1OfReal TabC(TabBuf(nu + nv + 3), 1, nc+1);
|
||||
|
||||
TColStd_Array1OfReal TabU(1,nu+1);
|
||||
TColStd_Array1OfReal TabV(1,nv+1);
|
||||
Standard_Integer NbSample = 20;
|
||||
Standard_Real U,V,Tdeb,Tfin;
|
||||
Tdeb=myCurve->FirstParameter();
|
||||
Tfin=myCurve->LastParameter();
|
||||
|
||||
nc=myCurve->NbIntervals(S);
|
||||
TColStd_Array1OfReal TabC(1,nc+1);
|
||||
myCurve->Intervals(TabC,S);
|
||||
|
||||
Standard_Real Tol= Precision::PConfusion()/10;
|
||||
|
Reference in New Issue
Block a user