On Thu, 31 May 2018 14:55:50 +0200, Ralf Goertz
<m...@myprovider.invalid> wrote:
>Hi,
>
>I have a problem with a program implementing the backtracking algorithm
>shown in <
https://en.wikipedia.org/wiki/Backtracking>. Everything is
>fine except for the fact that the program seems to be leaking. I use a
>variant of the algorithm that finds all solutions (find_all=true). In my
>case the memory usage still increases considerably although I already
>found solutions and accordingly recursion_depth stays at or below its
>maximum value of 65. According to my understanding this shouldn't
>happen. The relevant snippets are:
If you don't where or why the problem is occurring, then what is your
basis for deciding what is relevant? We need to see a complete
compilable example that demonstrates the problem. We don't need all
the internal details. If your sample exhibits the undesired behavior,
we have enough. The code you showed for first() is a suitable stub
for the function details we don't need and can be used as a template
for accept, reject, isValid, etc. We also need to see the actual
constructor for BT
I don't know if it is related or not but only one copy of a member
function exists, not a new copy for each class object. Consequently,
the variable found is common to all the objects and is initialized
before program execution begins. Once set to true, it is never set
back to false.
--
Remove del for email