In the past few days, the Code has been transplanted to the plug-in framework, because it was a single exe. I am not very concerned about memory leakage. It is different under the DLL, so add fastmm4 for monitoring debugging. It is found that there is a memory leakage during SQL parsing by scripparser.
There is a code segment.
var lvItem : TSuperObjectIter;begin if ObjectFindFirst(vParam, lvItem) then try repeat FScript := FastReplace(FScript, lvItem.key, FParamSetValue.S[LowerCase(lvItem.key)]); until not ObjectFindNext(lvItem); finally ObjectFindClose(lvItem); end;
Memory leakage exists. The problem was discovered only when I checked objectfindfirst.
Function objectfindfirst (const OBJ: isuperobject; var F: tsuperobjectiter): Boolean;
VaR
I: tsuperavlentry;
Begin
If objectistype (OBJ, stobject) then
Begin
F. ite: = tsuperavliterator. Create (obj. asobject );
F. Ite. first;
I: = f. Ite. getiter;
If I <> nil then
Begin
F. Key: = I. Name;
F. VAL: = I. value;
Result: = true;
End else
Result: = false;
// It is also possible that false is returned.
// F. ite: = tsuperavliterator. Create (obj. asobject );
End else
Result: = false;
End;
/// Finally modify the code without memory leakage
var lvItem : TSuperObjectIter;begin
try if ObjectFindFirst(vParam, lvItem) then repeat ……
until not ObjectFindNext(lvItem); finally
if lvItem.Ite <> nil then ObjectFindClose(lvItem); end;