You are not logged in.
Pages: 1
function testMormetJson():string;
var
jo: Variant;
i: Int64;
sTemp:string;
begin
TDocVariant.New(jo);
i := 0;
while i < 10 do
begin
jo.Name := 'This is a Str' + IntToStr(i);
jo.Age := i;
jo.List := _JSon('[1,"Hello",5,{"name":"c5soft","age":50}]');
sTemp:=sTemp+VariantSaveJSON(jo)+#13#10;
inc(i);
end;
result:=sTemp;
end;
////////////////////////////
well , this code is from somewhere ...
there is a "new" , no "free" found.
I can not find a method of "free" from TDocVariant .
Windows 7 64bit. Delphi XE10.2 Professional.
Offline
win7 64X
target 32
tokyo 10.2
Windows 7 64bit. Delphi XE10.2 Professional.
Offline
FreeAndNil(jo) doesn't work.
Windows 7 64bit. Delphi XE10.2 Professional.
Offline
Your above code doesn't leak memory.
The value is the variant variable.
TDocVariant is a meta-class, used to define the document custom type defined in SynCommons.
A variant is a value-type, with scope-based automatic reference (just like string, but without reference counting).
So there is no free.
Online
Pages: 1