Bug in JsonDiff when handling multiple changes
dancadar opened this issue · 5 comments
There is a bug in JsonDiff when comparing 2 jsons with more than a few changes (more than 6) which causes a memory leak (and crash due to insufficient memory)
using HashDiff to compare the same 2 jsons works as expected
Thanks for reporting this issue! However, I believe I am missing some information. Could you provide me with the old and the new value?
For instance,
JsonDiff.diff({a:'a', b:'b', c:'c', d:'d', e:'e', f:'f', g:'g'},
{a:'b', b:'c', c:'d', d:'e', e:'f', f:'g', g:'a'})has size 7 and does not have a memory leak.
Could you try using version 0.3.2 and trying again? I might have fixed it by correcting a seemingly unrelated bug.
@espadrine I can reproduce this. I am seeing the problem with large, nested hash / array combinations. If I diff them one way I get a successful result, if I reverse them I get an endless loop.
Reproduce endless loop in JsonDiff
I've broken this down into convenient files so you can see the different data, and the results of diffing them. Hope this is helpful.
@espadrine thanks for the update. Glad I could help.