Memory Leak in ClassesLib/THashTable
Brought to you by:
hhernler,
mackermann
In the Classes script library there is a memory leak. The
constructor does not fully destroy all THashItems in the
list. To get rid of this bug use the following patch in
ClassesLib\dws2HashTables.pas
destructor THashTable.Destroy;
begin
Clear;
FreeMem(FItems);
inherited;
end;
procedure THashTable.Clear;
var
x: Integer;
oldItem, hashItem: THashItem;
begin
for x := 0 to FCapacity - 1 do
begin
hashItem := FItems[x];
while Assigned(hashItem) do
begin
oldItem := hashItem;
hashItem := hashItem.Twin;
oldItem.Free;
end;
FItems[x] := nil;
end;
end;
This issue is fixed in DWSII 1.2
regards,
Matthias