ソースを参照

* postpone some freeing if SymbolInfo is needed

git-svn-id: trunk@6018 -
pierre 18 年 前
コミット
cc73d6e147
2 ファイル変更27 行追加2 行削除
  1. 19 0
      compiler/parser.pas
  2. 8 2
      compiler/pmodules.pas

+ 19 - 0
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

+ 8 - 2
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;