Hello,

Sorry for bothering you again with the same class, namely NaryUnion... When running the next piece of code, within valgrind (memcheck), I get a report for a memory leak...

#include "gecode/driver.hh"
#include "gecode/iter.hh"
using namespace Gecode;
class MySpace:public Space {
    public:
        virtual Space* copy(bool share){return this;}
};
int main(int argc, char* argv[]){
    MySpace home;
    Region region(home);
    for(int j=0;j<8;j++){
        Iter::Ranges::Empty e;
        Iter::Ranges::NaryUnion unio(region,e);
    }
}


The report is as follows:


==9213== HEAP SUMMARY:
==9213==     in use at exit: 40 bytes in 1 blocks
==9213==   total heap usage: 319 allocs, 318 frees, 94,497 bytes allocated
==9213==
==9213== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
==9213==    at 0x4C28FAC: malloc (vg_replace_malloc.c:236)
==9213== by 0x6582629: Gecode::Region::heap_alloc(unsigned long) (heap.hpp:324)
==9213==    by 0x40474F: main (region.hpp:306)
==9213==
==9213== LEAK SUMMARY:
==9213==    definitely lost: 40 bytes in 1 blocks
==9213==    indirectly lost: 0 bytes in 0 blocks
==9213==      possibly lost: 0 bytes in 0 blocks
==9213==    still reachable: 0 bytes in 0 blocks
==9213==         suppressed: 0 bytes in 0 blocks


The leak does not appear when looping only for 7 iterations instead of 8. This seems quite normal as the memory is allocated on the heap only when the region space is exhausted (according to MPG). I am using Gecode 3.7.1, gcc 4.5.2, Linux-Ubuntu 11.04 over a 64 bits architecture. Is it some kind of bug, or should I stop using NaryUnion once and for all?

Thank you again for your help,

Jean-Noël monette


_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to