Skip to content

Mesh - Stack overflow when meshing#695

Merged
dpasukhi merged 2 commits into
Open-Cascade-SAS:IRfrom
AtheneNoctuaPt:CR688
Aug 29, 2025
Merged

Mesh - Stack overflow when meshing#695
dpasukhi merged 2 commits into
Open-Cascade-SAS:IRfrom
AtheneNoctuaPt:CR688

Conversation

@AtheneNoctuaPt
Copy link
Copy Markdown
Collaborator

Fixed stack overflow by introducing StackOfFrames class that allows for iterative approach instead of recursive.

…pen-Cascade-SAS#688

Fixed stack overflow by introducing StackOfFrames class that allows for iterative approach instead of recursive.

// Try to infect neighbor nodes
IMeshData::VectorOfInteger aVictimNodes;
// std::list<Standard_Integer> aVictimNodes;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

@dpasukhi dpasukhi added 2. Bug Something isn't working 1. Mesh Incremental Mesh calculation, mesh processing or storage labels Aug 29, 2025
@dpasukhi dpasukhi linked an issue Aug 29, 2025 that may be closed by this pull request
@dpasukhi dpasukhi changed the title Stack overflow when meshing(with tbb) shapes from attached step file Mesh - Stack overflow when meshing Aug 29, 2025
@dpasukhi dpasukhi requested a review from Copilot August 29, 2025 16:29
@dpasukhi dpasukhi added this to the Release 7.9.2 milestone Aug 29, 2025
@dpasukhi dpasukhi self-requested a review August 29, 2025 16:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a stack overflow issue in the BRepMesh_Delaun meshing algorithm by replacing recursive calls with an iterative approach. The fix prevents stack overflow when processing large or deeply nested mesh structures.

Key changes:

  • Introduced StackOfFrames class to manage processing frames iteratively instead of recursively
  • Modified killTrianglesAroundVertex method to collect victim nodes in a provided container rather than recursively processing them
  • Replaced recursive depth-first traversal with iterative processing using the new stack-based approach

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
BRepMesh_Delaun.hxx Added theVictimNodes parameter to killTrianglesAroundVertex method signature
BRepMesh_Delaun.cxx Implemented StackOfFrames class and refactored polygon cleanup to use iterative processing

Comment thread src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_Delaun.cxx Outdated
@github-project-automation github-project-automation Bot moved this from Todo to Integration in Maintenance Aug 29, 2025
@dpasukhi dpasukhi merged commit 5bd2882 into Open-Cascade-SAS:IR Aug 29, 2025
23 checks passed
@github-project-automation github-project-automation Bot moved this from Integration to Done in Maintenance Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Mesh Incremental Mesh calculation, mesh processing or storage 2. Bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Stack overflow when meshing(with tbb) shapes from attached step file

3 participants