[Gecode] Memory management, where to alloc?

Christian Schulte schulte at imit.kth.se
Fri Jun 18 13:37:58 CEST 2004


Did you see what I did for the Element::Var propagator? There I also use a
list only (no cache). For the integer case I use a cache. It really depends.

Christian

--
Christian Schulte, http://www.imit.kth.se/~schulte/ 

-----Original Message-----
From: gecode-bounces at ps.uni-sb.de [mailto:gecode-bounces at ps.uni-sb.de] On
Behalf Of Guido Tack
Sent: Friday, June 18, 2004 1:37 PM
To: gecode at ps.uni-sb.de
Subject: Re: [Gecode] Memory management, where to alloc?


On Friday 18 June 2004 13:22, Christian Schulte wrote:
> Well, let me elaborate a little bit on 1). This is just for caching 
> and the reason why it works well is subtle and relies on interaction 
> (well, a certain discipline) with search:
>
> A propagator can have a cache. The cache is created on demand from 
> some other datastructure conatining the variables of interest (such as 
> an VarArray<*>). Each time the propagator is invoked, it checks wether 
> there is a cache. If not, it creates one. If there is already a cache, 
> the cache is updated to properly represent the modified variables. 
> Propagation then is performed on the cache.

Ok, that is exactly as I would have thought.

> So, please consider whether 1) does the job. It works well. The 
> variable doubling is not an issue for two reasons:
>  1) A variable (you mean a view actually) takes 4 byte.
>  2) There is just one cache per search engine and per propagator 
> created.

I will try. I guess with these explanations it should be easy, but I'm sure
I 
would have screwed up things badly again if I hadn't known the details ;-)

It still feels a bit weird to use a VarArray only to store the variables
that 
are needed to reconstruct the cache instead of storing them in a list in the

first place, however...

> Otherwise, there is no need to use freelists. As you rightly say, the 
> lists shrink. That's fine. Freelists are very special beasts (there 
> are only size 8 and 16 freelists). Don't use them if you don't have 
> to. I use them for rangelists as they have the property to grow and 
> not to shrink.

I see. Good to know.

Guido

-- 
Guido Tack
Programming Systems Lab
http://www.ps.uni-sb.de/~tack
_______________________________________________
Gecode mailing list
Gecode at ps.uni-sb.de http://www.ps.uni-sb.de/mailman/listinfo/gecode





More information about the gecode-users mailing list