[gecode-users] Controlling memory use

Mikael Zayenz Lagerkvist zayenz at gmail.com
Tue Apr 1 08:00:07 CEST 2008


On Tue, Apr 1, 2008 at 2:26 AM, Malcolm Ryan <malcolmr at cse.unsw.edu.au> wrote:
> On 31/03/2008, at 8:15 PM, Christian Schulte wrote:
>  > What contributes to memory consumption are:
>  > ...
>
>  Is there any way to simply ask Gecode how large a space is?

The reported memory consumption is accurate for Gecode (i.e., for the
C++ side). To get the size of a Gecode::Space, there is a member
function called allocated, that returns the amount of heap memory the
Space has allocated.

For Gecode/J the situation is not as simple. A org.gecode.Space object
is created for all the instances of the underlying C++ Gecode::Space
created when searching, and these instances will contain references to
other Java objects such as variables. AFAIK there is no accurate,
portable way of obtaining the size of a Java object for client code,
let alone for the connected graph of references that a Java object is
the root of. The most common technique seems to be creating a lot of
instances of something, and measuring total memory use before and
after. Thus, the overhead of using Gecode/J memory-wise is very hard
to compute exactly - even OS tools like top or the Task Manager are
not good enough due to the way a JVM manages memory.

To know anything more about why your particular problem runs out of
memory, you need to look at Christian's suggestions and questions. If
it turns out that available memory is a bottleneck for your
application, I would strongly suggest that you switch to plain Gecode.

Cheers,
Mikael

-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/




More information about the gecode-users mailing list