[gecode-users] Crash while freeing memory in connection with VS2010

Alexander Kleff alexander.kleff at ptv.de
Wed Jan 19 18:27:11 CET 2011


Hi once again,

the code below compiles and links in both versions (so I assume I did not make an all too obvious modeling mistake) but it crashes in VS2010 in contrast to VS2008(Express).
The error seems to occur during the destruction of the linear expression. The debugger sets the break point to Heap::rfree(void* p) in heap.hpp in all three cases.
Can you reproduce it?

Thanks for help,
Alexander



#include <gecode/minimodel.hh>

using namespace Gecode;

class GecodeTest : public Space {
public:
  GecodeTest(void)
  {
   IntVar z(*this, 0, 1);

   IntVar e1 = expr(*this, 1 * z);
   IntVar e2 = expr(*this, z);      // error 1

   IntArgs cost(2);
   for (int v=0; v<2; ++v)
   {
      cost[v] = v;
   }

   LinExpr xy = element(cost, z);
   IntVar e3 = expr(*this, xy);
   IntVar e4 = expr(*this, element(cost, z));   // error 2
  } // error 3 (in destructor)


  GecodeTest(bool share, GecodeTest& s) : Space(share, s) {}
  virtual Space* copy(bool share) { return new GecodeTest(share,*this); }
};


// main function
int main(array<System::String ^> ^args)
{
  GecodeTest* m = new GecodeTest;
  delete m;
  return 0;
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20110119/a97507da/attachment.htm>


More information about the users mailing list