Export to GitHub

mdpsim - issue #8

memory leak in terms.cc at lines 131 and 133


Posted on Jun 5, 2008 by Quick Rabbit

What steps will reproduce the problem? 1. run mdpsim on the blocksworld domain with problem p01.pddl from IPC-5 2. run a client with valgrind:

valgrind --tool=memcheck --leak-check=full /path/to/client --port=2323 --host=localhost /path/to/blocksworld-domain.pddl /path/to/p01-problem.pddl

  1. notice the memory leak in valgrind's output due to the non deletion of the variable 'objects' at lines 131 and 133 of file 'terms.cc':

==7905== ==7905== ERROR SUMMARY: 2403 errors from 1 contexts (suppressed: 19 from 1) ==7905== malloc/free: in use at exit: 16,986 bytes in 44 blocks. ==7905== malloc/free: 2,283,783 allocs, 2,283,739 frees, 48,827,677 bytes allocated. ==7905== For counts of detected errors, rerun with: -v ==7905== searching for pointers to 44 not-freed blocks. ==7905== checked 119,792 bytes. ==7905== ==7905== ==7905== 168 bytes in 14 blocks are definitely lost in loss record 1 of 4 ==7905== at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224) ==7905== by 0x405DA76: TermTable::compatible_objects(Type const&) const (terms.cc:133) ==7905== by 0x405D96B: TermTable::compatible_objects(Type const&) const (terms.cc:131) ==7905== by 0x406EC92: ActionSchema::instantiations(ActionSet&, TermTable const&, AtomSet const&, ValueMap const&) const (actions.cc:79) ==7905== by 0x4073133: Problem::instantiate() (problems.cc:178) ==7905== by 0x407E4B1: yyparse() (parser.yy:551) ==7905== by 0x80D958B: main (main_caylustest.cc:234) ==7905== ==7905== ==7905== 392 (168 direct, 224 indirect) bytes in 14 blocks are definitely lost in loss record 2 of 4 ==7905== at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224) ==7905== by 0x405D97A: TermTable::compatible_objects(Type const&) const (terms.cc:131) ==7905== by 0x406EC92: ActionSchema::instantiations(ActionSet&, TermTable const&, AtomSet const&, ValueMap const&) const (actions.cc:79) ==7905== by 0x4073133: Problem::instantiate() (problems.cc:178) ==7905== by 0x407E4B1: yyparse() (parser.yy:551) ==7905== by 0x80D958B: main (main_caylustest.cc:234) ==7905== ==7905== ==7905== 224 bytes in 14 blocks are indirectly lost in loss record 3 of 4 ==7905== at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224) ==7905== by 0x405E455: std::vector<Object, std::allocator<Object> >::_M_insert_aux(__gnu_cxx::__normal_iterator<Object*, std::vector<Object, std::allocator<Object> > >, Object const&) (new_allocator.h:91) ==7905== by 0x405DA68: TermTable::compatible_objects(Type const&) const (stl_vector.h:605) ==7905== by 0x406EC92: ActionSchema::instantiations(ActionSet&, TermTable const&, AtomSet const&, ValueMap const&) const (actions.cc:79) ==7905== by 0x4073133: Problem::instantiate() (problems.cc:178) ==7905== by 0x407E4B1: yyparse() (parser.yy:551) ==7905== by 0x80D958B: main (main_caylustest.cc:234) ==7905== ==7905== ==7905== 16,426 bytes in 2 blocks are still reachable in loss record 4 of 4 ==7905== at 0x4022AB8: malloc (vg_replace_malloc.c:207) ==7905== by 0x40818A9: yy_flex_alloc(unsigned) (tokenizer.cc:2137) ==7905== by 0x4081A96: yy_create_buffer(_IO_FILE*, int) (tokenizer.cc:1808) ==7905== by 0x4081E70: yylex() (tokenizer.cc:890) ==7905== by 0x407C586: yyparse() (parser.cc:2250) ==7905== by 0x80D958B: main (main_caylustest.cc:234) ==7905== ==7905== LEAK SUMMARY: ==7905== definitely lost: 336 bytes in 28 blocks. ==7905== indirectly lost: 224 bytes in 14 blocks. ==7905== possibly lost: 0 bytes in 0 blocks. ==7905== still reachable: 16,426 bytes in 2 blocks. ==7905== suppressed: 0 bytes in 0 blocks.

What is the expected output? What do you see instead?

valgrind should report no memory leak. Perhaps ObjectList class should derive from ObjectRC class, so that it could be automatically deleted?

What version of the product are you using? On what operating system?

mdpsim-2.2.2 on linux ubuntu 8.04

Please provide any additional information below.

Status: New

Labels:
Type-Defect Priority-Medium