Evgeny,
Wich object is the owner? If theres two strong references one of this must be declared as weak. If both are strong reference then the refcount will never reach 0 and the memory will never be disposed!
Can you please test that? Im fighting with this problem for a week and this is a signal of clear problems at the hour or release memory.
in your case, owner is soJsonData, that holds FObject (private variable of TROJSONValue):
constructor TROJSONValue.Create(aType: TROJSONDataType);
begin
inherited Create(nil);
FObject := nil;
case aType of
jdtObject: FObject := TROJSONObject.Create;
jdtArray: FObject := TROJSONArray.Create;
end;
..
end;
if I make FObject as weak variable, FObject will be destroyed after constructor is finished and before you can get access to it via soJsonData.AsObject.
you can try to replace FreeAndNil with DisposeOf in TROJSONValue.Clear, but I think, it will not improve situation.
it won’t work at all because table.DynamicWhere is private object that is created in TDADataTable.Create so at second call, after disposiing this object you will get reference to freed object
the same as before - this is reference to TROJSONValue.FObject
But then you can confirm is a memory leak in the actual code or dont?
I will try differents scenarios anyway, but will be better if the library solve that problem by self or you can suggest a better use of the library to avoid that inconvience?
you can try to isolate code that causes memory leak.
for example copy/paste some code into new app and perform execution of that snippet a lot of time in loop and see if memory will be leaked.