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

Guido Tack tack at ps.uni-sb.de
Thu Oct 15 17:42:55 CEST 2009


It was fixed in 2.2.0 and we forgot to mention it in the change log,  
sorry.

Cheers,
	Guido

David Rijsman wrote:

> Hi Guido,
>
> what version has this been fixed, I checked the release notes but  
> can not find anything?
>
> thanks,
>
> David
>
>>>>
> From: 	Guido Tack <tack at ps.uni-sb.de>
> To:	David Rijsman <David.Rijsman at quintiq.com>
> CC:	<users at gecode.org>
> Date: 	10/15/2009 5:08 PM
> Subject: 	Re: [gecode-users] VarArray<Var>::resize(Space& home, int m)
>
> Hi David,
>
> David Rijsman wrote:
>> 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?
>
> Yes, exactly.  The logic in 2.1.1 is completely flawed.
>
>> Being on the topic, what is the reason for resizing it on the heap
>> instead of keeping it in the Space which is available?
>
> That would possibly create a memory leak in the space, as the old
> array cannot easily be reused (it will be handed back to the space,
> but then it can only be used for freelist-allocated data).
>
> Cheers,
> 	Guido
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users





More information about the gecode-users mailing list