* fixed memory leaks in compiler.

git-svn-id: trunk@5369 -
This commit is contained in:
yury 2006-11-14 09:32:58 +00:00
parent ba53db3b5d
commit d8d25c2489
7 changed files with 25 additions and 8 deletions

View File

@ -316,6 +316,7 @@ implementation
{$endif} {$endif}
for hal:=low(TAsmListType) to high(TAsmListType) do for hal:=low(TAsmListType) to high(TAsmListType) do
AsmLists[hal].free; AsmLists[hal].free;
CurrAsmList.free;
{$ifdef MEMDEBUG} {$ifdef MEMDEBUG}
memasmlists.stop; memasmlists.stop;
{$endif} {$endif}

View File

@ -200,7 +200,7 @@ implementation
constructor TDirectoryCache.create; constructor TDirectoryCache.create;
begin begin
inherited create; inherited create;
FDirectories:=TFPHashObjectList.Create(false); FDirectories:=TFPHashObjectList.Create(true);
end; end;

View File

@ -1293,6 +1293,8 @@ implementation
unitsearchpath.Free; unitsearchpath.Free;
objectsearchpath.Free; objectsearchpath.Free;
includesearchpath.Free; includesearchpath.Free;
LinkLibraryAliases.Free;
LinkLibraryOrder.Free;
end; end;
procedure InitGlobals; procedure InitGlobals;

View File

@ -601,6 +601,7 @@ implementation
begin begin
if assigned(Data) then if assigned(Data) then
Data.Free; Data.Free;
stringdispose(FCachedFullName);
ObjRelocations.Free; ObjRelocations.Free;
ObjSymbolDefines.Free; ObjSymbolDefines.Free;
VTRefList.Free; VTRefList.Free;
@ -1323,7 +1324,7 @@ implementation
constructor TImportLibrary.create(AList:TFPHashObjectList;const AName:string); constructor TImportLibrary.create(AList:TFPHashObjectList;const AName:string);
begin begin
inherited create(AList,AName); inherited create(AList,AName);
FImportSymbolList:=TFPHashObjectList.Create(false); FImportSymbolList:=TFPHashObjectList.Create(true);
end; end;
@ -1538,6 +1539,7 @@ implementation
objsec:=TObjSection(TmpObjSectionList[i]); objsec:=TObjSection(TmpObjSectionList[i]);
CurrExeSec.AddObjSection(objsec); CurrExeSec.AddObjSection(objsec);
end; end;
TmpObjSectionList.Free;
end; end;

View File

@ -181,8 +181,6 @@ unit opttail;
oldnodes : tnode; oldnodes : tnode;
i : longint; i : longint;
begin begin
labelnode:=clabelnode.create(cnothingnode.create);
{ check if the parameters actually would support tail recursion elimination } { check if the parameters actually would support tail recursion elimination }
for i:=0 to p.paras.count-1 do for i:=0 to p.paras.count-1 do
with tparavarsym(p.paras[i]) do with tparavarsym(p.paras[i]) do
@ -190,6 +188,8 @@ unit opttail;
((varspez=vs_const) and ((varspez=vs_const) and
(paramanager.push_addr_param(varspez,vardef,p.proccalloption))) then (paramanager.push_addr_param(varspez,vardef,p.proccalloption))) then
exit; exit;
labelnode:=clabelnode.create(cnothingnode.create);
if find_and_replace_tailcalls(n) then if find_and_replace_tailcalls(n) then
begin begin
oldnodes:=n; oldnodes:=n;

View File

@ -2948,6 +2948,7 @@ implementation
dispose(inlininginfo); dispose(inlininginfo);
inlininginfo:=nil; inlininginfo:=nil;
end; end;
stringdispose(resultname);
stringdispose(import_dll); stringdispose(import_dll);
stringdispose(import_name); stringdispose(import_name);
if (po_msgstr in procoptions) then if (po_msgstr in procoptions) then

View File

@ -50,9 +50,12 @@ interface
end; end;
TExportLibWin=class(texportlib) TExportLibWin=class(texportlib)
private
st : string; st : string;
EList_indexed:TFPList; EList_indexed:TFPList;
EList_nonindexed:TFPList; EList_nonindexed:TFPList;
public
destructor Destroy;override;
procedure preparelib(const s:string);override; procedure preparelib(const s:string);override;
procedure exportprocedure(hp : texported_item);override; procedure exportprocedure(hp : texported_item);override;
procedure exportvar(hp : texported_item);override; procedure exportvar(hp : texported_item);override;
@ -572,6 +575,14 @@ implementation
TExportLibWin TExportLibWin
*****************************************************************************} *****************************************************************************}
destructor TExportLibWin.Destroy;
begin
EList_indexed.Free;
EList_nonindexed.Free;
inherited;
end;
procedure TExportLibWin.preparelib(const s:string); procedure TExportLibWin.preparelib(const s:string);
begin begin
if current_asmdata.asmlists[al_exports]=nil then if current_asmdata.asmlists[al_exports]=nil then
@ -666,8 +677,8 @@ implementation
if Gl_DoubleIndex then if Gl_DoubleIndex then
begin begin
message1(parser_e_export_ordinal_double,tostr(Gl_DoubleIndexValue)); message1(parser_e_export_ordinal_double,tostr(Gl_DoubleIndexValue));
EList_indexed.Free; FreeAndNil(EList_indexed);
EList_nonindexed.Free; FreeAndNil(EList_nonindexed);
exit; exit;
end; end;
@ -694,10 +705,10 @@ implementation
EList_nonindexed.Delete(ni_high); EList_nonindexed.Delete(ni_high);
texported_item(EList_indexed.Items[pred(AutoIndex)]).index:=autoindex; texported_item(EList_indexed.Items[pred(AutoIndex)]).index:=autoindex;
end; end;
EList_nonindexed.Free; FreeAndNil(EList_nonindexed);
for i:=0 to pred(EList_indexed.Count)do for i:=0 to pred(EList_indexed.Count)do
exportfromlist(texported_item(EList_indexed.Items[i])); exportfromlist(texported_item(EList_indexed.Items[i]));
EList_indexed.Free; FreeAndNil(EList_indexed);
if (target_asm.id in [as_i386_masm,as_i386_tasm,as_i386_nasmwin32]) then if (target_asm.id in [as_i386_masm,as_i386_tasm,as_i386_nasmwin32]) then
begin begin