hmm34 / CS-Image-Segmentation-Solver

Project 1 of Advanced Algorithms Sp'14 - It implements the Ford-Fulkerson network flow algorithm and uses it to solve an image segmentation problem.
0 stars 0 forks source link

Fix segfault in BFS timing metrics #13

Closed hmm34 closed 10 years ago

hmm34 commented 10 years ago

The breadth first search timing metrics segfault when totalVE approaches 4300.

hmm34 commented 10 years ago

This stems from the integer 2D array matrix representation of a graph created in generateRandomGraph. When the number of vertices approaches 1450 (on my laptop, at least) - iseg tries to throw the 1450x1450 integer array of on the stack - which surpasses the stack limit of 8192 bytes.

This was definitely the easiest approach for throwing random numbers around, but we'll have to move this to adjacency list format. Woohoo, memory management!

hmm34 commented 10 years ago

Fixed with dynamic allocation