Unplanned
Last Updated: 28 May 2020 12:26 by ADMIN
ADMIN
Aylin
Created on: 01 Nov 2016 15:40
Category: SpreadProcessing
Type: Bug Report
4
SpreadProcessing: Setting values of cells referred from formulas causes performance issues due to memory leak
CellSelection.SetValue method causes memory leak of CellReferenceRangeExpression objects in some cases when cell value is referenced by formulas. The memory leak is small, but the remaining CellReferenceRangeExpression continue to listen to some events, causing performance issues when their number become large - the time to set the value increases with each set.
7 comments
ADMIN
Dimitar
Posted on: 28 May 2020 12:26

Hi,

A possible workaround when you need to set a large number of cells it to suspend the ProertyChanged event of the Cells. Currently, this can be done only with reflection:

Worksheet worksheet = workbook.Worksheets[0];

var field = worksheet.Cells.GetType().GetField("propertyBag", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(worksheet.Cells);
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Telerik.Windows.Documents.Spreadsheet.dll");
Assembly assembly = Assembly.LoadFile(path);
Type propertyBag = assembly.GetType("Telerik.Windows.Documents.Spreadsheet.PropertySystem.CellsPropertyBag", true);
MethodInfo suspend = propertyBag.GetMethod("SuspendPropertyChanged", BindingFlags.NonPublic | BindingFlags.Instance);
MethodInfo resume = propertyBag.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance).Where(x => x.Name == "ResumePropertyChanged").FirstOrDefault();

suspend.Invoke(field, null);

//Update cells values

resume.Invoke(field, null);

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
ADMIN
Tanya
Posted on: 03 Feb 2017 16:55
Hello Diego,

The item is with status "Approved", which means it is included in our backlog. However, the issue is not scheduled for fixing in the next release and I am unable to say when a fix might be available.

Regards,
Tanya
Diego
Posted on: 01 Feb 2017 20:55
is this fixed ?
ADMIN
Stefan
Posted on: 09 Dec 2016 15:00
@Adel do you mean the Speadsheet control or the SpreadProcessing library?
Adel Chenni
Posted on: 04 Dec 2016 16:52
We are noticing the same thing with telerik mvc spreadsheet. 
ADMIN
Boby
Posted on: 07 Nov 2016 11:42
Thanks for the additional information @Mark. We will update the item with our latest findings. If you find any other relevant information, let us know - here or in the support system.
Mark
Posted on: 01 Nov 2016 21:44
I don't think that the description is exactly correct.  The problem seems to happen no matter the size of the spreadsheet.  The test program that Mike wrote (see this thread: http://www.telerik.com/forums/spreadsheet-slows-exponentially-with-repeated-calculations) calls SetValue() repeatedly for the same cell.  This is a very small spreadsheet.

It looks like every time that SetValue() is called, it gets slower.  And this is not a new issue.  We have been waiting for quite a while for SP1 to get this fix and now that we have tested it, we find that the speed has improved, but it still slows down by a factor of 25-30 times when SetValue() is called 30,000 times.  I suggest that you test using Mike's test program, as it clearly shows the issue.

So please try to address this as soon as possible and please make it available as a hotfix, as this is really a problem for me.

Thanks,
Mark