mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-05 18:28:51 +01:00
* TFPHashlist.Pack now also reclaims unused string memory
git-svn-id: trunk@23252 -
This commit is contained in:
parent
49cb967614
commit
48c3adfdb9
@ -1552,20 +1552,31 @@ var
|
||||
i : integer;
|
||||
pdest,
|
||||
psrc : PHashItem;
|
||||
FOldStr : Pchar;
|
||||
|
||||
begin
|
||||
NewCount:=0;
|
||||
psrc:=@FHashList^[0];
|
||||
pdest:=psrc;
|
||||
For I:=0 To FCount-1 Do
|
||||
begin
|
||||
if assigned(psrc^.Data) then
|
||||
begin
|
||||
pdest^:=psrc^;
|
||||
inc(pdest);
|
||||
inc(NewCount);
|
||||
end;
|
||||
inc(psrc);
|
||||
end;
|
||||
FOldStr:=FStrs;
|
||||
try
|
||||
FStrs:=Nil;
|
||||
FStrCount:=0;
|
||||
FStrCapacity:=0;
|
||||
pdest:=psrc;
|
||||
For I:=0 To FCount-1 Do
|
||||
begin
|
||||
if assigned(psrc^.Data) then
|
||||
begin
|
||||
pdest^:=psrc^;
|
||||
Pdest^.strindex:=AddStr(PShortString(@FOldStr[PDest^.StrIndex])^);
|
||||
inc(pdest);
|
||||
inc(NewCount);
|
||||
end;
|
||||
inc(psrc);
|
||||
end;
|
||||
finally
|
||||
FreeMem(FoldStr);
|
||||
end;
|
||||
FCount:=NewCount;
|
||||
{ We need to ReHash to update the IndexNext }
|
||||
ReHash;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user