laz-JSON-Viewer icon indicating copy to clipboard operation
laz-JSON-Viewer copied to clipboard

memory overflow

Open cn17173 opened this issue 1 year ago • 3 comments

There are still more memory leak issues present. Switching from test1.json to test2.json increases memory usage by 0.1MB.

cn17173 avatar May 21 '23 15:05 cn17173

Hey @cn17173,

Thanks for the report!! As soon as I have time, I'll have a go at finding the problem !!

Cheers, Gus

gcarreno avatar May 23 '23 01:05 gcarreno

The following two lines of code in the function UpdateTreeFromNode in the unit LJV.Forms.Main may cause memory leaks: treeNode^.NodeName:=TJSONObject(AJSONData).Names[index]; treeNode^.NodePath:= treeNode^.NodePath + '.' + treeNode^.NodeName;. lt seems that assigning dynamically allocated string objects to treeNode·.NodeName without releasing the originalobjects may lead to memory leaks. However,l don't know how to modify it.

SetLength(treeNode^.NodeName, 0); SetLength(treeNode^.NodePath, 0); can solve the memory overflow problem, but it will lose the values of NodeName and NodePath.

cn17173 avatar May 25 '23 17:05 cn17173

Hey @cn17173,

I'm very, VERY grateful for your initial leg work!!! This will, for sure, narrow my attention and will be quicker !!

Again, sorry I don't have time right now to pursue it, but it's on my todo list and it will not be forgiven!!

Cheers, Gus

gcarreno avatar May 26 '23 02:05 gcarreno