Hi Danijel,
Sorry for late response, have to do testing in several cases.
Per your answer, I resolved the issue about return result from TRtcRecord.FromJSON but a memory leak still there. After do more debugging, I found a cause that came from RtcScriptEngine. (I use RtcDataProvider to call script that call RtcFunction, so debugging is a bit difficult).
When using RtcScriptEngine.Execute, I used a global VAR of TRtcValue to receive a result return from script engine, now I realize that return result from RtcScriptEngine is seem like return result from RTCFunction, mean RTC will create not me, so I changed the code as in the following and the memory leak is gone.
TqslHtmlCommandDispatcher = class(TComponent)
private
FScriptResult: TRtcValue;
.. .
procedure TqslHtmlCommandDispatcher.ExecScript(const aScript: string);
begin
FreeAndNil(FScriptResult);
FScriptResult:= FScriptEngine.Execute(FDataServer, FScriptEngine.Compile(aScript));
end;
As per this issue, could you clarify me about these questions:-
1. TRtcRecord.FromJSON(j_son) is a class method, that will create an instance when use. If we already have an instance, we have to use .asJSON instead?
2. If we use global var to received return result from RtcScriptEngine, we need to free it before next received. I tried using FScriptResult:= nil; is not enough, still got memory leak.
Thank you for your great product and support
Best Regards,
Theprasit