This is a migrated thread and some comments may be shown as answers.

[Solved] Diff engine out of memory exception

4 Answers 183 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Geoffrey
Top achievements
Rank 1
Geoffrey asked on 11 Feb 2010, 09:21 PM
We have been using the RadEditor's diff engine for some time now to compare strings, and it has worked quite well for us. Recently, however, we have run into a problem where were are seeing the exception "system.outofmemoryexception was thrown" when comparing two long XML strings.

Here is how we use the diff engine:

Dim strValue1 As String  
Dim strValue2 As String  
Dim strResult As String  
Dim diff As New Diff.DiffEngine  
 
' ...code here assigns long XML strings to strvalue1 and strvalue2; srvalue1's length = 93145; strvalue2's length = 113236...  
 
strResult = diff.GetDiffs(strValue2, strValue1)  
 

Are there length limitations for the strings that can be passed to the diff engine?

Thanks,

Geoff LeBlond
Silverchair Science & Communications

4 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 12 Feb 2010, 02:01 PM
Hello Geoff,

There are no set limits for the size of the compared strings. Perhaps the error is caused by an internal error in the parser, because it is written with HTML in mind and you said that you are comparing XML strings. I just tried comparing two 250KB HTML files and there was no problem, except for the fact that it took more than 10 seconds to compare them.

Regards,
Lini
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Geoffrey
Top achievements
Rank 1
answered on 12 Feb 2010, 09:53 PM

I misspoke when I said that we are comparing XML strings. They are actually HTML strings. Here are links to files containing the two strings we use in the diff engine comparison:

strvalue1.txt is here: http://www.datafilehost.com/download-3a0859c3.html
strvalue2.txt is here: http://www.datafilehost.com/download-4560767f.html

Can you please try comparing the two strings found in these files and see if you also get a memory exception. As mentioned, we compare them in this order:

strResult = diff.GetDiffs(strValue2, strValue1)

Thanks.

Geoff

0
Geoffrey
Top achievements
Rank 1
answered on 16 Feb 2010, 02:02 PM
ping
0
Lini
Telerik team
answered on 17 Feb 2010, 08:22 AM
Hi Geoff,

Thank you for the provided sample. I was able to reproduce the OOM exception and can confirm that it happens because of a limitation in the diff engine in RadEditor. The code depends on the number of HTML elements and did not fail for me, because my test had more text and less html. Your example had a great number of small paragraphs, which possibly triggered the problem. I have logged this issue and can confirm that the diff engine will be updated in the next RadControls release (Q1 2010, scheduled for March). The updated engine will run much faster and be able to support larger HTML fragments.

Greetings,
Lini
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Editor
Asked by
Geoffrey
Top achievements
Rank 1
Answers by
Lini
Telerik team
Geoffrey
Top achievements
Rank 1
Share this question
or