[gecode-users] Heap memory exhausted when copying a model

Guido Tack tack at gecode.org
Sun Sep 29 21:47:33 CEST 2013


Please read MPG on cloning, stable spaces etc.  You have to call status() before you can clone a space if you have posted propagators in the space.  And you have to check if status returns failed, because then you cannot clone either (but in your case I would guess that the space can never be failed at that point).

Cheers,
Guido

-- 
Guido Tack
http://www.csse.monash.edu/~guidot/



On 29/09/2013, at 9:41 PM, kTorpi <ktorpi at gmail.com> wrote:

> Thank you very much.
> Now when I use the clone function I get another exception: "Space::clone: Attempt to invoke operation on not stable space" I've read in MPG that this is because the space is failed or not stable, but I don't know what this realy means. Why can my space be unstable? I can post constraints and I can get the solutions, so everything seems to be fine.
> 
> Thanks in advance,
> Steve
> 
> 
> 2013/9/29 Guido Tack <tack at gecode.org>
> Hi,
> 
> you cannot call the copy constructor directly.  Just change the line where you're trying to make the copy into
> 
>   SendMoreMoney* m2 = static_cast<SendMoreMoney*>(m->clone(true));
> 
> and it will work.  (It's a little unfortunate that there is no better error message, but if you call "internal" functionality in Gecode things like this can happen.)
> 
> Cheers,
> Guido
> 
> -- 
> Guido Tack
> http://www.csse.monash.edu/~guidot/
> 
> 
> 
> On 29/09/2013, at 5:37 PM, kTorpi <ktorpi at gmail.com> wrote:
> 
>> Hello,
>> 
>> In my application i'm building a model through a long process, and in the middle of the process I'd like to make a copy of the actual model, post some constraints to the copied and get the solution.
>> But when I make a copy of the model with is copy constructor and than I create the DFS object I get a Gecode::MemoryExhausted exception.
>> Please, help me. I attached a small example that reproduces the error.
>> 
>> Thanks you,
>> Steve
>> <send-more-money-de-mystified.cpp>_______________________________________________
>> Gecode users mailing list
>> users at gecode.org
>> https://www.gecode.org/mailman/listinfo/gecode-users
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20130929/cbb9050a/attachment.html>


More information about the users mailing list