* free unregistered elements of the localsymtable after a module has been

compiled

git-svn-id: trunk@32160 -
This commit is contained in:
Jonas Maebe 2015-10-26 19:56:09 +00:00
parent ed211b9888
commit 7d5262ef78

View File

@ -550,6 +550,30 @@ implementation
end;
procedure free_unregistered_localsymtable_elements;
var
i: longint;
def: tdef;
sym: tsym;
begin
{ from high to low so we hopefully have moves of less data }
for i:=current_module.localsymtable.symlist.count-1 downto 0 do
begin
sym:=tsym(current_module.localsymtable.symlist[i]);
{ this also frees sym, as the symbols are owned by the symtable }
if not sym.is_registered then
current_module.localsymtable.Delete(sym);
end;
for i:=current_module.localsymtable.deflist.count-1 downto 0 do
begin
def:=tdef(current_module.localsymtable.deflist[i]);
{ this also frees def, as the defs are owned by the symtable }
if not def.is_registered then
current_module.localsymtable.deletedef(def);
end;
end;
procedure setupglobalswitches;
begin
if (cs_create_pic in current_settings.moduleswitches) then
@ -1256,6 +1280,8 @@ type
Message1(unit_u_implementation_crc_changed,current_module.ppufilename);
{$endif EXTDEBUG}
{ release unregistered defs/syms from the localsymtable }
free_unregistered_localsymtable_elements;
{ release local symtables that are not needed anymore }
free_localsymtables(current_module.globalsymtable);
free_localsymtables(current_module.localsymtable);