I have created a small multi-threaded application and I am trying to convert it to OmniThreadLibrary. I use Virtualtreeview to display log and status / results. There are only two columns in Vst Log, and a record contains only two string fields (extremely simple, with no objects inside the record).
Using the DEMO project that comes with OTL (thread pool # 11), I changed the project to use VirtualTreeview instead of a list. When I run the Task from the demo version, there is no memory leak, but if I run the Run Task more than once, a memory leak will occur. A memory leak will occur if I run any task more than once. If I do not use VirtualTreeView at all, memory leaks do not occur at any time. Just when I use VST and when a task runs more than once.
I use the FreeNode event and clear the lines and even try to use Finalize ...
Example:
procedure TFormMain.vstLogFreeNode(Sender: TBaseVirtualTree;
Node: PVirtualNode);
var
LogData: PTreeLogData;
begin
LogData:=Sender.GetNodeData(Node);
if Assigned(LogData) then begin
LogData^.Msgtype := '';
LogData^.Msg := '';
end;
//Finalize(LogData^);
end;
Why do I get a memory leak when completing a task more than once? Delphi 2010 with FastMM4 latest Virtualtreeview and OTL