[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] memory usage of SAT4J

Le 17/02/2013 13:13, Mengxin Zhu a écrit :
> Hi Daniel and Pascal,
>
> I observed SAT4J library need lots of memory for resolving dependencies.
>
> In our case we want to install 677 root IUs, and there are totally
> 17000 IUs in multiple repositories. More than 240M memory was used in
> resolving process. Especially SAT4J library totally created more than
> 210M int[] instances, and held them until the calculating completed.
> Above memory usage data is obtained in VisualVM.
>
> Is it expected behavior to create and hold such large int array for
> calculating the dependencies? If it's unavoidable trade-off for the
> calculating, do we have a formula to estimate how much memory will be
> required when resolving dependencies in certain number of IUs?
>
> Thank you in advance,
> Cheers,
>   Mengxin Zhu
> _______________________________________________
> p2-dev mailing list
> p2-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/p2-dev

Hi Mengxin,

Sat4j uses arbitrary precision arithmetic (BigInteger) to manage the
weights used to order the UIs.
We use really big weights (e.g. with 30 digits!) to make sure that those
IUs are applied whatever the consequence are (e.g. for patches).

In some cases, the information can be stored on long, to reduce memory
usage. This is available in  Sat4j 2.3.3 for instance.

sat4j 2.3.3 is currently being considered for inclusion with Kepler. If
you can provide us with a test case, we could check if we could reduce
the memory footprint
using long instead of BigInteger.

Another way to reduce the memory footprint would be to cache the
BigInteger object used: the objective function reuses many time the same
weight.
Reusing the same BigInteger object each time should significantly
decrease the memory footprint too.

Cheers,

Daniel