Opened 5 years ago

Closed 5 years ago

#2183 closed defect (fixed)

Memory leak in range constructor + case statement

Reported by: Dimitar Misev Owned by: apercov
Priority: critical Milestone: 10.0
Component: qlparser Version: 9.8
Keywords: Cc: Bang Pham Huu, Vlad Merticariu
Complexity: Medium

Description

The following query causes a memory leak:

valgrind --tool=memcheck --track-origins=yes --leak-check=full \
directql -q 'SELECT { CASE WHEN ( c0 = 1 ) THEN ( 0 ) ELSE ( 1 ) END } 
             FROM test_grey as c0'

==27995== 182 (144 direct, 38 indirect) bytes in 1 blocks are definitely lost in loss record 249 of 271
==27995==    at 0x4835DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
==27995==    by 0x38C4D3: QtRangeConstructor::checkType(QtTypeTuple*) (qtrangeconstructor.cc:303)
==27995==    by 0x37850D: QtOperationIterator::checkType() (qtoperationiterator.cc:282)
==27995==    by 0x3A7640: QueryTree::checkSemantics() (querytree.cc:106)
==27995==    by 0x2ABE4A: ServerComm::executeQuery(unsigned long, char const*, ExecuteQueryRes&, bool) (servercomm.cc:761)
==27995==    by 0x222C61: RasServerEntry::compat_executeQueryRpc(char const*, ExecuteQueryRes&) (rasserver_entry.cc:123)
==27995==    by 0x299858: rasserver::directql::doStuff() (rasserver_directql.cc:714)
==27995==    by 0x224865: main (rasserver_main.cc:200)
==27995== 
==27995== 6,000 bytes in 1 blocks are possibly lost in loss record 268 of 271
==27995==    at 0x4838123: memalign (vg_replace_malloc.c:899)
==27995==    by 0x29B8A6: mymalloc(unsigned long) (mymalloc_svc.cc:44)
==27995==    by 0x4FE2B6: DBTile::DBTile(unsigned long, char, r_Data_Format) (dbtile.cc:145)
==27995==    by 0x4FCFAE: BLOBTile::BLOBTile(unsigned long, char, r_Data_Format) (blobtilecommon.cc:74)
==27995==    by 0x48F937: Tile::Tile(r_Minterval const&, BaseType const*, r_Data_Format) (tile.cc:201)
==27995==    by 0x30DB1E: QtCaseOp::evaluateInducedOp(std::vector<QtData*, std::allocator<QtData*> >*) (qtcaseop.cc:211)
==27995==    by 0x30F627: QtCaseOp::evaluate(std::vector<QtData*, std::allocator<QtData*> >*) (qtcaseop.cc:460)
==27995==    by 0x370D7F: QtNaryOperation::getOperands(std::vector<QtData*, std::allocator<QtData*> >*, std::vector<QtData*, std::allocator<QtData*> >*&) (qtnaryoperation.cc:199)
==27995==    by 0x38B54C: QtRangeConstructor::evaluate(std::vector<QtData*, std::allocator<QtData*> >*) (qtrangeconstructor.cc:116)
==27995==    by 0x378326: QtOperationIterator::next() (qtoperationiterator.cc:252)
==27995==    by 0x3A78DD: QueryTree::evaluateRetrieval() (querytree.cc:168)
==27995==    by 0x2ABF60: ServerComm::executeQuery(unsigned long, char const*, ExecuteQueryRes&, bool) (servercomm.cc:767)
==27995== 
==27995== 228,792 (112 direct, 228,680 indirect) bytes in 1 blocks are definitely lost in loss record 271 of 271
==27995==    at 0x4835DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
==27995==    by 0x30F392: QtCaseOp::evaluateInducedOp(std::vector<QtData*, std::allocator<QtData*> >*) (qtcaseop.cc:443)
==27995==    by 0x30F627: QtCaseOp::evaluate(std::vector<QtData*, std::allocator<QtData*> >*) (qtcaseop.cc:460)
==27995==    by 0x370D7F: QtNaryOperation::getOperands(std::vector<QtData*, std::allocator<QtData*> >*, std::vector<QtData*, std::allocator<QtData*> >*&) (qtnaryoperation.cc:199)
==27995==    by 0x38B54C: QtRangeConstructor::evaluate(std::vector<QtData*, std::allocator<QtData*> >*) (qtrangeconstructor.cc:116)
==27995==    by 0x378326: QtOperationIterator::next() (qtoperationiterator.cc:252)
==27995==    by 0x3A78DD: QueryTree::evaluateRetrieval() (querytree.cc:168)
==27995==    by 0x2ABF60: ServerComm::executeQuery(unsigned long, char const*, ExecuteQueryRes&, bool) (servercomm.cc:767)
==27995==    by 0x222C61: RasServerEntry::compat_executeQueryRpc(char const*, ExecuteQueryRes&) (rasserver_entry.cc:123)
==27995==    by 0x299858: rasserver::directql::doStuff() (rasserver_directql.cc:714)
==27995==    by 0x224865: main (rasserver_main.cc:200)
==27995== 
==27995== LEAK SUMMARY:
==27995==    definitely lost: 256 bytes in 2 blocks
==27995==    indirectly lost: 228,718 bytes in 307 blocks
==27995==      possibly lost: 6,000 bytes in 1 blocks

Change History (2)

comment:1 by apercov, 5 years ago

Status: newaccepted

comment:2 by apercov, 5 years ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.