Hi Gustavo, did you register the brancher for disposal? It's described in sect. 19.4 in MPG, have a look at the way home.notice() is called for the brancher in the example.
Cheers, Guido > On 4 Nov 2014, at 1:58 pm, Gustavo Gutierrez <[email protected]> > wrote: > > Dear Gecode users, > > This is probably a naive question and very related to C++. However, it is > quite related to gecode as well. In my use case I have a shared pointer to an > object that contains all the information of a problem instance. As usual, the > constructor is where the CSP is defined and that object is passed as an > argument to it. > > In addition, I implemented a brancher that also require some of the > information pointed by the shared pointer. Note that this infromation is not > actually needed to construct the brancher but when computing a choice. I have > tried several ways to make both the brancher and the shared_pointer happy > with their respective requirements. However I have found myself in the > following situation. > > When I add the shared_pointer as an attribute to the brancher I get the > shared pointer reference counter messed up. The reason is that the brancher > does not actually have a destructor and hence the shared_pointer counter is > never decremented and the owned pointer is never destructed at the end of the > solver execution. I tried to explicitly call the destructor of the shared > pointer in the dispose method of the brancher. However, it seems that the > brancher gets copied more times than the dispose method is called. > > Is there a way to integrate both approaches smoothly?. Probably I am > overlooking something. > > Regards, > Gustavo > > > _______________________________________________ > Gecode users mailing list > [email protected] > https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
