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

Mikael Zayenz Lagerkvist zayenz at gmail.com
Wed Nov 7 07:47:22 CET 2007


On 11/6/07, Malcolm Ryan <malcolmr at cse.unsw.edu.au> wrote:
>
> 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.


Thanks for finding this bug for us. We haven't actually tested
creating variables with empty domains much.

Both errors should really be translated into real Java exceptions that
can be caught.


> 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.

It is a special case, since we have no representation of an empty
domain internally that respects all the invariants.


If Gecode/J makes the JVM crash again, the hs_err_pid????.log file
contains some information that may help find the problem. Attaching
the file would help us help you.


Cheers,
Mikael

-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/




More information about the gecode-users mailing list