Patch to huge memory consumption in LO Calc

Kohei Yoshida kohei.yoshida at
Tue May 27 07:29:46 PDT 2014

Hello William,

On Sat, 2014-05-24 at 14:47 +0200, William Bonnet wrote:

> I attach to this bug entry a proposal for a patch which solve this 
> problem. A call to shrink_to_fit has been added in the resize_block 
> method. In order to limit the number of call to this method, and wasting 
> too much time releasing memory, i only call it when its current size is 
> half of its capacity (real number of element vs number of element 
> allocated).

So, I would look at this from 2 angles.  One is from the angle of the
container itself, which is what you already did.  It's a great analysis
and, while we still need to adjust your change to not require C++11 (as
Stephan already pointed out) as well as the non-binding nature of
shrink_to_fit(), the main idea is sound and we should incorporate it
into multi_type_vector's low-level array management.

Another angle is the code that handles subtotals to see if we could do
it differently in a way that would avoid shrinking of the raw level
arrays.  Many existing call cites that accesses multi_type_vector are
still optimized for the old, ScBaseCell-based cell storage which may not
work well with the new array-based storage.  And the subtotal code may
be just one of those.  But this can be done another time.  We are slowly
migrating the call sites to have them perform optimally for the new
storage, and it takes some time.

I'll look into incorporating your change to mdds sometime soon.

Thanks again!


More information about the LibreOffice mailing list