[gecode-users] Memory trouble when implementing a brancher

Anders Helmar svumpukkel2001 at gmail.com
Sun Dec 12 12:19:22 CET 2010


Hi..

I'm facing a problem with memory leaks when implementing my own brancher in
Gecode 3.4.0, using the GCC compiler on an ubuntu platform.

My problem is that I want to save both a position for a variable but also a
list of values to branch on. This list is created as a vector<int> in the
implemented brancher together with the position as

mutable vector<int> alternatives;
mutable int v;

I have a choice object as well with a vector and an integer to be stored in
the choice.

In the status() function I fill in the alternatives with the push_back()
function, and it is here I get my leaks when running with valgrind.

When I have created the choice in the Choice() function of the brancher I
remember to clear the vector of alternatives (Since choice takes a local
copy for the choice object).

I suppose that when deleting my choice pointer in the search engine, I also
delete the elements in the list of alternatives in the choice object? I
suspect that the problem lies within the garbage collector of the choice.

Hope you can help!

Cheers,
Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20101212/bd91704a/attachment.htm>


More information about the users mailing list