summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-06-19 13:11:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-06-19 14:07:02 +0200
commit64362b2e10ad5cbe88374bcafa6d5f120d27fe5b (patch)
treeb8fa351013e3a5443806087888f61e884b5d5ce8 /sc
parentfe5983da2f504606c531a9b8bbc876c210b1e133 (diff)
fix memory usage regression when loading files with lots of marks
regression from commit 3c3a371c799d00475deb13b4c3e0a8860c7e4fb3 Author: Noel Grandin <noel.grandin@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@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/markmulti.cxx9
1 files changed, 6 insertions, 3 deletions
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