coin-or / Couenne

Convex Over and Under Envelopes for Nonlinear Estimation
Eclipse Public License 1.0
69 stars 7 forks source link

memory leaks in CouenneProblem #2

Open svigerske opened 5 years ago

svigerske commented 5 years ago

Issue created by migration from Trac.

Original creator: @svigerske

Original creation time: 2010-01-21 09:39:02

Assignee: somebody

Version:

Hi,

running the OS unittest under valgrind reveals several memory leaks in Couenne. I think they are not caused by OS, since I have seen similar ones somewhere else. This was with Couenne 0.2.

==23490== Memcheck, a memory error detector.
==23490== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==23490== Using LibVEX rev 1732, a library for dynamic binary translation.
==23490== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==23490== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==23490== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==23490== For more details, rerun with: -v
==23490== 
==23490== 
==23490== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 1)
==23490== malloc/free: in use at exit: 1,320 bytes in 54 blocks.
==23490== malloc/free: 540,683 allocs, 540,629 frees, 4,957,640,517 bytes allocated.
==23490== For counts of detected errors, rerun with: -v
==23490== searching for pointers to 54 not-freed blocks.
==23490== checked 304,560 bytes.
==23490== 
==23490== 8 bytes in 1 blocks are indirectly lost in loss record 1 of 15
==23490==    at 0x4A05EA5: operator new[](unsigned long) (vg_replace_malloc.c:199)
==23490==    by 0x530550: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:268)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 24 bytes in 1 blocks are indirectly lost in loss record 2 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x52E6DF: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:310)
==23490==    by 0x530567: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:269)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 24 bytes in 3 blocks are indirectly lost in loss record 3 of 15
==23490==    at 0x4A05EA5: operator new[](unsigned long) (vg_replace_malloc.c:199)
==23490==    by 0x5CCC67: exprSum::exprSum(expression**, int) (exprSum.cpp:23)
==23490==    by 0x5C4936: exprGroup::exprGroup(double, std::vector<std::pair<exprVar*, double>, std::allocator<std::pair<exprVar*, double> > >&, expression**, int) (exprGroup.cpp:79)
==23490==    by 0x5301F6: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:236)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 32 bytes in 2 blocks are indirectly lost in loss record 4 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x52EED9: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:367)
==23490==    by 0x52E6B7: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:310)
==23490==    by 0x530567: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:269)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 32 bytes in 2 blocks are indirectly lost in loss record 5 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x52F30C: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:407)
==23490==    by 0x52E8BC: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:333)
==23490==    by 0x52EECC: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:367)
==23490==    by 0x52E6B7: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:310)
==23490==    by 0x530567: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:269)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 48 bytes in 2 blocks are indirectly lost in loss record 6 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x52EEF6: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:367)
==23490==    by 0x52E6B7: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:310)
==23490==    by 0x530567: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:269)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 48 bytes in 2 blocks are indirectly lost in loss record 7 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x52E8C9: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:333)
==23490==    by 0x52EECC: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:367)
==23490==    by 0x52E6B7: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:310)
==23490==    by 0x530567: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:269)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 48 bytes in 2 blocks are indirectly lost in loss record 8 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x52F3DA: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:417)
==23490==    by 0x52E8A1: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:333)
==23490==    by 0x52EECC: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:367)
==23490==    by 0x52E6B7: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:310)
==23490==    by 0x530567: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:269)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 48 bytes in 3 blocks are indirectly lost in loss record 9 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x5CCC88: exprSum::exprSum(expression**, int) (exprSum.cpp:24)
==23490==    by 0x5C4936: exprGroup::exprGroup(double, std::vector<std::pair<exprVar*, double>, std::allocator<std::pair<exprVar*, double> > >&, expression**, int) (exprGroup.cpp:79)
==23490==    by 0x5301F6: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:236)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 128 (56 direct, 72 indirect) bytes in 1 blocks are definitely lost in loss record 10 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x5301CA: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:236)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 80 bytes in 5 blocks are indirectly lost in loss record 11 of 15
==23490==    at 0x4A05EA5: operator new[](unsigned long) (vg_replace_malloc.c:199)
==23490==    by 0x533E8C: exprOp::exprOp(expression*, expression*) (exprOp.hpp:51)
==23490==    by 0x533F16: exprSub::exprSub(expression*, expression*) (exprSub.hpp:30)
==23490==    by 0x52E8E2: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:333)
==23490==    by 0x52EECC: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:367)
==23490==    by 0x52E6B7: CouenneSolver::createCouenneExpression(OSnLNode*) (OSCouenneSolver.cpp:310)
==23490==    by 0x530567: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:269)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 240 (112 direct, 128 indirect) bytes in 2 blocks are definitely lost in loss record 12 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x530604: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:272)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 128 bytes in 3 blocks are indirectly lost in loss record 13 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x5344D1: __gnu_cxx::new_allocator<std::pair<exprVar*, double> >::allocate(unsigned long, void const*) (new_allocator.h:92)
==23490==    by 0x5344FF: std::_Vector_base<std::pair<exprVar*, double>, std::allocator<std::pair<exprVar*, double> > >::_M_allocate(unsigned long) (stl_vector.h:144)
==23490==    by 0x534544: std::_Vector_base<std::pair<exprVar*, double>, std::allocator<std::pair<exprVar*, double> > >::_Vector_base(unsigned long, std::allocator<std::pair<exprVar*, double> > const&) (stl_vector.h:117)
==23490==    by 0x5B2ABE: std::vector<std::pair<exprVar*, double>, std::allocator<std::pair<exprVar*, double> > >::vector(std::vector<std::pair<exprVar*, double>, std::allocator<std::pair<exprVar*, double> > > const&) (stl_vector.h:248)
==23490==    by 0x5C4952: exprGroup::exprGroup(double, std::vector<std::pair<exprVar*, double>, std::allocator<std::pair<exprVar*, double> > >&, expression**, int) (exprGroup.cpp:79)
==23490==    by 0x5301F6: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:236)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 376 (56 direct, 320 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x53057B: CouenneSolver::buildSolverInstance() (OSCouenneSolver.cpp:270)
==23490==    by 0x416959: main (unitTest.cpp:1674)
==23490== 
==23490== 
==23490== 576 bytes in 24 blocks are definitely lost in loss record 15 of 15
==23490==    at 0x4A06205: operator new(unsigned long) (vg_replace_malloc.c:167)
==23490==    by 0x5C4AD5: exprGroup::exprGroup(exprGroup const&, Domain*) (exprGroup.cpp:94)
==23490==    by 0x5C521D: exprGroup::clone(Domain*) const (exprGroup.hpp:57)
==23490==    by 0x5B6467: exprAux::exprAux(exprAux const&, Domain*) (exprAux.cpp:67)
==23490==    by 0x5B7F8D: exprAux::clone(Domain*) const (exprAux.hpp:82)
==23490==    by 0x5AA08B: exprCopy::exprCopy(exprCopy const&, Domain*) (expression.cpp:127)
==23490==    by 0x534606: exprClone::exprClone(exprClone const&, Domain*) (exprClone.hpp:34)
==23490==    by 0x534645: exprClone::clone(Domain*) const (exprClone.hpp:38)
==23490==    by 0x533CC7: exprOp::clonearglist(Domain*) const (exprOp.hpp:99)
==23490==    by 0x533DDB: exprPow::clone(Domain*) const (exprPow.hpp:40)
==23490==    by 0x5B6467: exprAux::exprAux(exprAux const&, Domain*) (exprAux.cpp:67)
==23490==    by 0x5B7F8D: exprAux::clone(Domain*) const (exprAux.hpp:82)
==23490== 
==23490== LEAK SUMMARY:
==23490==    definitely lost: 800 bytes in 28 blocks.
==23490==    indirectly lost: 520 bytes in 26 blocks.
==23490==      possibly lost: 0 bytes in 0 blocks.
==23490==    still reachable: 0 bytes in 0 blocks.
==23490==         suppressed: 0 bytes in 0 blocks.

Stefan

svigerske commented 5 years ago

Comment by @merraksh created at 2010-01-22 18:41:15

Changing assignee from somebody to @merraksh.

svigerske commented 5 years ago

Comment by @merraksh created at 2010-01-22 18:41:15

Changing status from new to assigned.

svigerske commented 5 years ago

Comment by @merraksh created at 2010-01-22 18:57:59

Hi Stefan,

most of those memory are present in the original Couenne as well. I am still in the process of tracking them down. I'll check whether there are other leaks.

Pietro