I use OmniThreadLibrary
. It has a parallel method ForEach
.
I'm working on high loaded system and I need to handle some array in parallel. But I get a memory leak.
Here is a sample:
procedure TForm7.FormCreate(Sender: TObject);
var loop: IOmniParallelLoop<Integer>;
begin
while True do
begin
loop := Parallel.ForEach(1, 100);
loop.Execute(procedure (const i: Integer)
begin
end);
loop := nil;
Sleep(100);
end;
end;
When I run this code, I can see a virtual memory leak.
What is wrong?