From cc73d6e1475a4cde8a74d7c6d1db9d7b23eca8e1 Mon Sep 17 00:00:00 2001 From: pierre Date: Wed, 17 Jan 2007 05:46:21 +0000 Subject: [PATCH] * postpone some freeing if SymbolInfo is needed git-svn-id: trunk@6018 - --- compiler/parser.pas | 19 +++++++++++++++++++ compiler/pmodules.pas | 10 ++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/compiler/parser.pas b/compiler/parser.pas index b8a5d6af42..9e74c7ce89 100644 --- a/compiler/parser.pas +++ b/compiler/parser.pas @@ -277,6 +277,7 @@ implementation var olddata : polddata; + hp,hp2 : tmodule; begin inc(compile_level); parser_current_file:=filename; @@ -471,6 +472,24 @@ implementation (status.errorcount=0) then begin parser_current_file:=''; + { Write Browser Collections } + do_extractsymbolinfo; + { free now what we did not free earlier in + proc_program PM } + if needsymbolinfo then + begin + hp:=tmodule(loaded_units.first); + while assigned(hp) do + begin + hp2:=tmodule(hp.next); + if (hp<>current_module) then + begin + loaded_units.remove(hp); + hp.free; + end; + hp:=hp2; + end; + end; { Close script } if (not AsmRes.Empty) then begin diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index 8a88b03290..fb31afa84e 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -1482,8 +1482,13 @@ implementation { assemble and link } create_objectfile; + { We might need the symbols info if not using + the default do_extractsymbolinfo + which is a dummy function PM } + needsymbolinfo:=do_extractsymbolinfo<>@def_extractsymbolinfo;; { release all local symtables that are not needed anymore } - free_localsymtables(current_module.localsymtable); + if (not needsymbolinfo) then + free_localsymtables(current_module.localsymtable); { leave when we got an error } if (Errorcount>0) and not status.skip_error then @@ -1509,7 +1514,8 @@ implementation begin linker.AddModuleFiles(hp); hp2:=tmodule(hp.next); - if hp<>current_module then + if (hp<>current_module) and + (not needsymbolinfo) then begin loaded_units.remove(hp); hp.free;