[gecode-users] Gecode/J: Invalid Memory Access

Malcolm Ryan malcolmr at cse.unsw.edu.au
Tue Nov 6 11:56:11 CET 2007


On 06/11/2007, at 6:10 PM, Malcolm Ryan wrote:

> I'm getting a crash in my Gecode/J program with the message:
>
>   Invalid memory access of location 00000004 eip=0e61227c

I've isolated the cause. The domain IntSet was empty.
The following code will reproduce the bug:

    Space space = new Space() {};
    IntSet empty = new IntSet(new int[0]);
    IntVar bad = new IntVar(space, empty);

Similarly the line:

    IntVar bad = new IntVar(space, 1, 0);

will produce the error:

   terminate called after throwing an instance of  
'Gecode::Int::VariableEmptyDomain'
      what():  IntVar::IntVar: Attempt to create variable with empty  
domain

which is better that a memory error, but which really should respond  
with an Exception that can be caught at the Java level.

I think the correct solution is to allow a variable to be created  
with an empty domain. This would just result in a model that is never  
satisfiable, which is nothing unusual and is quite straightforward to  
handle. I don't see any real reason to single it out as a special case.

Malcolm
--
      "Progress should mean that we are always changing the world to fit
       the vision, instead we are always changing the vision."
                - G.K.Chesterton, Orthodoxy







More information about the gecode-users mailing list