Memory leaks in TJSONMarshal fixable?
Memory leaks in TJSONMarshal fixable?
I have same problem, does anyone know how to solve
Autor:Benjamin Wittfoth
The last few days I was redesigning my storage entities for JSON handling. After some really good results and quite some work I was wondering why the memory is depleting so fast. So I activated fastmm4 and - Oo - really bad memory situation. So I tried to find any mistakes on my side - without luck.
So I decided to write a tiny sample program to make sure that the mistake is on my side - unfortunately it seems that it is not.
Can somebody please tell me why there are leaks of TMoveArrayManager, TDBXArrayList, TStringBuilder, TJSONString, TJSONObject, TJSONPair after executing this tiny piece of code?
{code}
procedure TForm4.Button1Click(Sender: TObject);
var
_Marshal: TJSONMarshal;
_test:TTest;
_Strings:TStringlist;
begin
_Test:=TTest.Create;
_Marshal:=TJSONMarshal.Create;
_Strings:=TStringlist.Create;
try
_Strings.Text:=_Marshal.Marshal(_test).ToString;
_Strings.SaveToFile(
self.AppPath+'testdata.json'
);
finally
_Strings.free;
_test.Free;
_Marshal.Free;
end;
end;
{code}
{code}
TTest=class
private
fName:String;
protected
public
constructor Create;virtual;
end;
{code}
I have same problem, does anyone know how to solve
Autor:Benjamin Wittfoth
The last few days I was redesigning my storage entities for JSON handling. After some really good results and quite some work I was wondering why the memory is depleting so fast. So I activated fastmm4 and - Oo - really bad memory situation. So I tried to find any mistakes on my side - without luck.
So I decided to write a tiny sample program to make sure that the mistake is on my side - unfortunately it seems that it is not.
Can somebody please tell me why there are leaks of TMoveArrayManager, TDBXArrayList, TStringBuilder, TJSONString, TJSONObject, TJSONPair after executing this tiny piece of code?
{code}
procedure TForm4.Button1Click(Sender: TObject);
var
_Marshal: TJSONMarshal;
_test:TTest;
_Strings:TStringlist;
begin
_Test:=TTest.Create;
_Marshal:=TJSONMarshal.Create;
_Strings:=TStringlist.Create;
try
_Strings.Text:=_Marshal.Marshal(_test).ToString;
_Strings.SaveToFile(
self.AppPath+'testdata.json'
);
finally
_Strings.free;
_test.Free;
_Marshal.Free;
end;
end;
{code}
{code}
TTest=class
private
fName:String;
protected
public
constructor Create;virtual;
end;
{code}
Comments
Post a Comment