summaryrefslogtreecommitdiff
path: root/sc/source/core/data
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 15:10:16 +0200
commit2528c62283a834ae44f9d0f34db9493c4957b2d7 (patch)
treebdd465478bc5e6e30dbfc0a03701e388c91d9e54 /sc/source/core/data
parenta19abb2f465f3eef4d4f6e7677d5b027673f76d6 (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> (cherry picked from commit 64362b2e10ad5cbe88374bcafa6d5f120d27fe5b) Reviewed-on: https://gerrit.libreoffice.org/74358
Diffstat (limited to 'sc/source/core/data')
-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