[Libreoffice-commits] core.git: sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 19 12:07:46 UTC 2019


 sc/source/core/data/markmulti.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 64362b2e10ad5cbe88374bcafa6d5f120d27fe5b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jun 19 13:11:41 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jun 19 14:07:02 2019 +0200

    fix memory usage regression when loading files with lots of marks
    
    regression from
    
        commit 3c3a371c799d00475deb13b4c3e0a8860c7e4fb3
        Author: Noel Grandin <noel.grandin at collabora.co.uk>
        Date:   Wed May 15 15:35:51 2019 +0200
        tdf#125254 Performance: A spreadsheet opens too slow, part2
    
    without this fix, the file from the above bug chews up more than 16G and
    crashes my box. With the fix, it loads, and requires about 2G.
    
    Change-Id: I87063196e56b49eab52e77126347bf8d421b1e0f
    Reviewed-on: https://gerrit.libreoffice.org/74352
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/core/data/markmulti.cxx b/sc/source/core/data/markmulti.cxx
index a4a66933dba6..644dfad21f6c 100644
--- a/sc/source/core/data/markmulti.cxx
+++ b/sc/source/core/data/markmulti.cxx
@@ -277,10 +277,10 @@ void ScMultiSel::Set( ScRangeList const & rList )
                 auto & rMarkEntries = aMarkEntriesPerCol[nCol];
                 int nEntries = rMarkEntries.size();
                 if (nEntries > 1 && nStartRow >= rMarkEntries[nEntries-2].nRow+1
-                   && nStartRow <= rMarkEntries[nEntries-1].nRow)
+                   && nStartRow <= rMarkEntries[nEntries-1].nRow+1)
                 {
-                    // overlaps previous range
-                    rMarkEntries.back().nRow = nEndRow;
+                    // overlaps or directly adjacent previous range
+                    rMarkEntries.back().nRow = std::max(nEndRow, rMarkEntries.back().nRow);
                 }
                 else
                 {
@@ -298,7 +298,10 @@ void ScMultiSel::Set( ScRangeList const & rList )
     aMultiSelContainer.resize(nMaxCol+1);
     for (SCCOL nCol = 0; nCol<=nMaxCol; ++nCol)
         if (!aMarkEntriesPerCol[nCol].empty())
+        {
             aMultiSelContainer[nCol].Set( aMarkEntriesPerCol[nCol] );
+            aMarkEntriesPerCol[nCol].clear(); // reduce peak memory usage
+        }
 }
 
 bool ScMultiSel::IsRowMarked( SCROW nRow ) const


More information about the Libreoffice-commits mailing list