Overcalculation/Overflow issue

This is a discussion on Overcalculation/Overflow issue within the Windows Programming forums, part of the Platform Specific Boards category; I don't know if I used the right terms. I am writing a program to create and pathing of a ...

Overcalculation/Overflow issue

I don't know if I used the right terms. I am writing a program to create and pathing of a big maze, that had involved a lot of calculation. The program sometimes works fine, but sometimes make the machine hangs up. Looks like the huge operations make it crash. Will there be any method to fix it? Or something like increase the internal memory? Tks.

The problem can be a stack overflow. In which case a recursive function or method uses too much static memory.
The problem might be an infinite loop. In some cases it never ends.
The problem might be indeed too much calculations/memory consumption in some cases.

There are a lot of possible solutions depending on the problem. So post some code.

If you think that it is a memory problem, try freeing memory you don't need anymore before allocating new. If you think it is too much calculations, then inspect your algorithm in the worst case scenarios.

Tks. Attached is the source code. Please help and provide your valuable advise. By the way, would you need me know how to " freeing memory you don't need anymore before allocating new"? I guess it would help. Tks.