[Coin-discuss] CoinPackedMatrix memory management
Jörg Herbers
herbers at hotmail.com
Wed Jul 30 07:48:11 EDT 2003
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?
Jörg
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
More information about the Coin-discuss
mailing list