Menu

#1 Memory Leak in ClassesLib/THashTable

v1.1
open
nobody
7
2003-01-24
2003-01-24
No

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

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.