stanle / madopt

Apache License 2.0
16 stars 5 forks source link

Example, tests and reported lost memory #13

Closed paul-scott closed 7 years ago

paul-scott commented 7 years ago

Hey Karsten I have a colleague that is trying to run madopt. He got everything installed on his mac, but when it comes to running the madopt python example he gets a segfault. I'll investigate more and provide more details as I get them. For now I noticed that when I run the madopt tests on my system (the python example works for me), I get lost memory errors from valgrind, here is an example record and the summary:

==1649== 127,744 bytes in 998 blocks are definitely lost in loss record 309 of 309
==1649==    at 0x4C2B1EC: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1649==    by 0x453D5E: std::vector<unsigned int, std::allocator<unsigned int> >::_M_default_append(unsigned long) (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x455F01: MadOpt::SimStack::doMull() (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x450F9C: MadOpt::InnerConstraint::caseMUL(MadOpt::Stack&) (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x451434: MadOpt::InnerConstraint::computeFinalStack(MadOpt::Stack&) (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x4517C7: MadOpt::InnerConstraint::InnerConstraint(MadOpt::Expr const&, double, double, std::unordered_map<std::pair<unsigned int, unsigned int>, int, std::hash<std::pair<unsigned int, unsigned int> >, std::equal_to<std::pair<unsigned int, unsigned int> >, std::allocator<std::pair<std::pair<unsigned int, unsigned int> const, int> > >&, MadOpt::SimStack&) (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x448BE3: MadOpt::Model::addConstr(double, MadOpt::Expr const&, double) (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x44911C: MadOpt::Model::addEqConstr(MadOpt::Expr const&, double) (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x442EC1: IpoptModelTest::testResolveTutorial() (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x421670: CxxTest::RealTestDescription::run() (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x429E20: int CxxTest::Main<CxxTest::ErrorPrinter>(CxxTest::ErrorPrinter&, int, char**) (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649==    by 0x41D4CB: main (in /home/pscott/programming/madopt/build/unittest_madopt)
==1649== 
==1649== LEAK SUMMARY:
==1649==    definitely lost: 1,638,384 bytes in 28,274 blocks
==1649==    indirectly lost: 0 bytes in 0 blocks
==1649==      possibly lost: 0 bytes in 0 blocks
==1649==    still reachable: 216 bytes in 2 blocks
==1649==         suppressed: 0 bytes in 0 blocks
==1649== Reachable blocks (those to which a pointer was found) are not shown.
==1649== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==1649== 
==1649== For counts of detected and suppressed errors, rerun with: -v
==1649== ERROR SUMMARY: 307 errors from 307 contexts (suppressed: 0 from 0)

Did you have the tests running clean without any valgrind errors at one point?

stanle commented 7 years ago

fixed. Was working on issue #2 and forgot to set the deconstructor of a base class to virtual.

paul-scott commented 7 years ago

Your the man, thanks Karsten! I'll check and see if this causes the issue on Mac, otherwise will investigate that separately.