Open Helaas opened 2 years ago
Hello - and thank you for the the feedback;
We have just made a simple use case and can confirm you are right. It produces a memory leak. We will fix it as soon as possible.
Thank you again.
On Tue, Apr 5, 2022 at 2:15 PM Helaas @.***> wrote:
Hello,
I've been playing around with json_Merge(Objects). I've noticed that json_Merge & json_MergeObjects cause json_MemLeak to return true. json_NodeClone does not have this behavior.
json_MergeObjects
pFrom = json_parseString ('{ - "s" : "Life is a gift", - "a" : [1,2,3,4], - "o" : { - "x" : 100, - "y" : 200 - } - }');
// "to" is just an empty object at begining pTo = json_newObject();
// copy all elements: This is deep copy json_MergeObjects(pTo:pFrom:json_REPLACE);
Content = json_AsJsonText(pFrom); Content2 = json_AsJsonText(pTo);
json_delete(pTo); json_delete(pFrom); inlr = on;
Memleak = json_MemLeak(); //Will return 1!
json_Merge
pFrom = json_parseString ('{ - "s" : "Life is a gift", - "a" : [1,2,3,4], - "o" : { - "x" : 100, - "y" : 200 - } - }');
// "to" is just an empty object at begining pTo = json_newObject();
// copy all elements: This is deep copy json_Merge(pTo:pFrom:json_DONTREPLACE);
Content = json_AsJsonText(pFrom); Content2 = json_AsJsonText(pTo);
json_delete(pTo); json_delete(pFrom); inlr = on;
Memleak = json_MemLeak(); //Will return 1!
json_NodeClone
pFrom = json_parseString ('{ - "s" : "Life is a gift", - "a" : [1,2,3,4], - "o" : { - "x" : 100, - "y" : 200 - } - }');
// copy all elements: This is deep copy pTo = json_NodeClone(pFrom)
Content = json_AsJsonText(pFrom); Content2 = json_AsJsonText(pTo);
json_delete(pTo); json_delete(pFrom); inlr = on;
Memleak = json_MemLeak(); //Will return 0!
— Reply to this email directly, view it on GitHub https://github.com/sitemule/noxDB/issues/67, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVIPHQEPVJZR7HICZ4R4U3VDQVEDANCNFSM5SSRYPAQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@NielsLiisberg What's the status here?
Unfortunately we have not had time to fix it yet - It is on the TODO list - it is not forgotten.
Hello,
I've been playing around with json_Merge(Objects). I've noticed that json_Merge & json_MergeObjects cause json_MemLeak to return true. json_NodeClone does not have this behavior.
json_MergeObjects
json_Merge
json_NodeClone