[Coin-discuss] CoinPackedMatrix memory management
Laszlo Ladanyi
ladanyi at us.ibm.com
Wed Jul 30 14:16:23 EDT 2003
On Wed, 30 Jul 2003, Jörg Herbers wrote:
> When building a sparse matrix with several ten thousand non-zero entries
> with CoinPackedMatrix, I have run into performance problems: When I
> successively added columns without manual actions wrt. memory management
> (matrix is column-ordered), it took several minutes to build the matrix.
> When reserving memory before (via CoinPackedMatrix::reserve), initialization
> times reduce to fractions of a second.
>
> I have found that a reallocation is done every time a column is added (in
> resizeForAddingMajorVectors) if memory is not allocated before. Effectively,
> all data vectors are newly allocated and copied.
>
> Clearly, manual allocation via reserve() is always possible, but the
> calculation of the number of non-zeros can be cumbersome. Instead, it would
> be better to have an enhanced memory management, e.g. by using "realloc"
> style memory management (which does not always copy the memory blocks) and
> by reserving extra space upon each resize operation (i.e. always
> reallocating for a given "delta" of additional elements). Is there anything
> planned in that direction?
Actually, this extra space reservation is in the CoinPackedMatrix class. The
extraGap_ and extraMajor_ members indicate the extra percentage to be
allocated for new nonzeros and columns (for column major ordered matrix).
At least that was the plan. I just looked at the code and found a stupid bug.
Fixed it and committed it.
Please, check it out and test it.
>
> Jörg
>
> _________________________________________________________________
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at www-124.ibm.com
> http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss
>
Thanks for the bug report!
--Laci
More information about the Coin-discuss
mailing list