Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception of type 'System.OutOfMemoryException' was thrown using - JsonDiffPatch() #28

Open
devanathan2017 opened this issue Mar 1, 2019 · 1 comment

Comments

@devanathan2017
Copy link

devanathan2017 commented Mar 1, 2019

Hi ,

I have two list lstA(33727 records) and lstB(34238 records). Converting those as json string and trying to compare using JsonDiffPatch. code below

lstA = GetRateCard();
lstB = rates.Meters.ToList();

var first = JsonConvert.SerializeObject(lstA);
var second = JsonConvert.SerializeObject(lstB);

var jdp = new JsonDiffPatch();
var output = jdp.Diff(first, second); ----->>> getting the out of memory exception screen shot also attached.

error

stack trace:
at JsonDiffPatchDotNet.Lcs.LcsInternal(List1 left, List1 right) in c:\Dev\wbish_github\jsondiffpatch.net\Src\JsonDiffPatchDotNet\Lcs.cs:line 31
at JsonDiffPatchDotNet.Lcs.Get(List1 left, List1 right) in c:\Dev\wbish_github\jsondiffpatch.net\Src\JsonDiffPatchDotNet\Lcs.cs:line 24
at JsonDiffPatchDotNet.JsonDiffPatch.ArrayDiff(JArray left, JArray right) in c:\Dev\wbish_github\jsondiffpatch.net\Src\JsonDiffPatchDotNet\JsonDiffPatch.cs:line 399
at JsonDiffPatchDotNet.JsonDiffPatch.Diff(JToken left, JToken right) in c:\Dev\wbish_github\jsondiffpatch.net\Src\JsonDiffPatchDotNet\JsonDiffPatch.cs:line 54
at JsonDiffPatchDotNet.JsonDiffPatch.Diff(String left, String right) in c:\Dev\wbish_github\jsondiffpatch.net\Src\JsonDiffPatchDotNet\JsonDiffPatch.cs:line 276
at DomainOperations.RateOperations.DailyRates(DataResponse rates) in E:\Cloud Service Providers Project\BILLINGAPI\DomainOperations\RateOperations.cs:line 308

However if i try with few records saw 2000 each i am able see the expected results. not sure how to deal with more data ? need help

Thanks
Dev.

@wbish
Copy link
Owner

wbish commented Mar 2, 2019

Hey @devanathan2017 a workaround to unblock you would be to do:

var options = new Options();
options.ArrayDiff = ArrayDiffMode.Simple;
var jdp = new JsonDiffPatch(options)

I'll have to take a deeper look to see what we can do in the mean time about the default behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants