[Gecode] Memory leak in the sets

Gabor Szokoli szokoli at ps.uni-sb.de
Thu Sep 2 12:48:53 CEST 2004


Guido Tack wrote:

>On Thursday 02 September 2004 10:41, Christian Schulte wrote:
>  
>
>>I would like to clarify the problem here: it is not about how destructors
>>are handeled, it is about the simple point that space-allocated memory is
>>just not useful for temporary data structures. This is absolutely clear.
>>    
>>
>
>  
>
The temporal datastructure in question is an IntegerSet, re-used from 
our variable bound implementation, that's why it allocates its dynamic 
memory from the space.
It is local to a Propagator.propagate() invocation. We have n+1 of them 
in each nary filtering function.
Would you suggest creating a heap-allocating version for such puropses? 
(would that have any benefit at all?)
Or using a dedicated, localy cerated memory-manager instead of the home 
space which we can just discard in the end of the method call without 
deconstructing each local dynamic entity one by one? (that would match 
the philosophy of an AUTOARRAY holding (and dropping) the non-dynamic parts)

>Sure. But in our case it's about a variable that a propagator collects 
>information in over its whole life time, and it is allocated on a free list. 
>So it is neither temporary nor "really" space allocated. 
>
Yes, it is persistent information of a propagator, even across cloning.
Is a virtual void Propagator.cleanup(Space) that would be called in the 
ES_SUBSUMED branch of the propagator loop out of the question?

If yes:
An ugly workaround would be to create a fresh SetVar in the posting 
function, and feed that to the constructor of the propagator, which it 
could then use as its internal storage.
This is of course only shoveling the sh*t over a fence and labeling it 
"fertiliser", without any real benefit, as unreferenced variables are 
not freed (how do you spell that???) either, just not copied next 
time... (right?)

>A different story 
>are the real temporaries that we use (which are of course also free list 
>allocated), of course.
>
>  
>
I was talking about these in the first half.


Gabor

PS: anything to take my mind off these nasty BDDs :-)




More information about the gecode-users mailing list