[gecode-users] VarArray<Var>::resize(Space& home, int m)

David Rijsman David.Rijsman at quintiq.com
Thu Oct 15 16:56:03 CEST 2009


Dear All,

I have a question on the method "void  VarArray<Var>::resize(Space& home, int m)".

 I am on version 2.1.1 and noticed the method has changed somewhere between version 2.1.1 and the 3.2.0. I can not find any reason in the change list for the change.

I noticed this because I am, what I think, experiencing a memory leak. I am resizing my IntVarArray during execution which forces it to be allocated on the heap. In the destructor of the array there is a check to see if we need to free the heap, the check in (2.1.1) looks like " if (used != n) ". I think this check is failing in my case and therefor the heap does not get freed. 

The changes made to "VarArray<Var>::resize(Space& home, int m)" seem to influence the values 'used' and 'n' (they have been named differently now). Has the change been made to prevent a memory leak?

Being on the topic, what is the reason for resizing it on the heap instead of keeping it in the Space which is available?

David





More information about the gecode-users mailing list