Modeling Data and Algorithms Thu, 01/29/2026 - 14:13

HLRBRep_Algo

Author

Occasionally, a segmentation fault occurs when executing the HLRBRep_Algo::Hide() method. Could you please tell me what might be causing this issue

Discussion

Commenter-1 Fri, 01/30/2026 - 11:08

Hello.

Please share the code and file to reproduce. Also please share the OCCT version which you are using.

Best regards, Commenter-1.

Author Sat, 01/31/2026 - 12:56

Occasionally, this issue occurs when the call frequency is high. Could it be a memory allocation problem? The version is 7.8.0

Commenter-1 Sat, 01/31/2026 - 13:22

Please also share the code. The frequency means you call it in multithread?

Best regards, Commenter-1.

Author Fri, 03/13/2026 - 10:35

Hello, the issue has been resolved. The array out-of-bounds exception occurred at the position marked with a red box in the attachment

Commenter-2 Sat, 03/14/2026 - 14:15

Do you mean you have swapped conditions to check the range before accessing array value and this solved issue with random crashes, or just localized the crash place?

      Standard_Integer im1=0;
-      for(i=1; IndUV[i0][i]!=-1 && i<nbUV[i0]; i++,im1++) {
+      for(i=1; i<nbUV[i0] && IndUV[i0][i]!=-1; i++,im1++) {
Author Mon, 03/16/2026 - 04:18

Check the array range before accessing array values, which is the green line in the image

Author Sat, 01/31/2026 - 14:23

No multithreading is used.

TopoDS_Shape topoShape;
BRepTools::Read(topoShape, "filename", BRep_Builder());
for (int i = 0; i < 500; i++)
{
HLRAlgo_Projector algoProjector(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)));
Handle(HLRBRep_Algo) pHLRAlgo = new HLRBRep_Algo;
pHLRAlgo->Add(topoShape);
pHLRAlgo->Projector(algoProjector);
pHLRAlgo->Update();
pHLRAlgo->Hide();
}