reclaiming memory

21 views
Skip to first unread message

Mats Carlsson

unread,
May 17, 2022, 3:08:05 AM5/17/22
to Gecode
Hi, I have a program that reads some input, builds a model, and solves it. At the root of the search tree, i.e., having built the model but before any search, the memory use seems a bit excessive. During posting, a lot of IntSet, IntArgs, IntVarArgs, TupleSet, BoolVarArgs are created on the fly. Is it safe to erase such objects after posting the respective constraint? Are they erased automatically anyway? Any other hints for reclaiming memory or finding out what is actually taking so much space?

Thanks in advance, --Mats

Mikael Zayenz Lagerkvist

unread,
May 23, 2022, 9:31:42 AM5/23/22
to gec...@googlegroups.com
Hi Mats,

You are quite correct in that posting may add some memory overhead to
a Gecode Space. The way to reclaim unused Space memory in Gecode is to
make a clone of the Space, cloning and garbage collection are related
operations.

Depending on the options given to a Gecode search engine, the root may
or may not be cloned initially (standard is to clone). If you are only
going to use a single search engine, then the easiest way is to ensure
you are using cloning, and just deleting the original Space.

Hope this helps,
Mikael

On Tue, May 17, 2022 at 9:08 AM Mats Carlsson <matsc...@gmail.com> wrote:
>
> Hi, I have a program that reads some input, builds a model, and solves it. At the root of the search tree, i.e., having built the model but before any search, the memory use seems a bit excessive. During posting, a lot of IntSet, IntArgs, IntVarArgs, TupleSet, BoolVarArgs are created on the fly. Is it safe to erase such objects after posting the respective constraint? Are they erased automatically anyway? Any other hints for reclaiming memory or finding out what is actually taking so much space?
>
> Thanks in advance, --Mats
>
> --
> You received this message because you are subscribed to the Google Groups "Gecode" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gecode+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/gecode/ea67ce63-5b76-496c-8c50-fda5212825b5n%40googlegroups.com.



--
Mikael Zayenz Lagerkvist
Reply all
Reply to author
Forward
0 new messages