浏览代码

* several memory leaks fixed

pierre 27 年之前
父节点
当前提交
7621dc0b56

+ 6 - 3
compiler/cg386add.pas

@@ -938,7 +938,7 @@ implementation
                              exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_B,newreference(p^.location.reference),
                                hregister)));
                           end;
-                        clear_location(p^.left^.location);
+                        clear_location(p^.location);
                         p^.location.loc:=LOC_REGISTER;
                         p^.location.register:=hregister;
                      end;
@@ -1071,7 +1071,7 @@ implementation
                                 gten : flags:=F_AE;
                           end;
                         end;
-                       clear_location(p^.left^.location);
+                       clear_location(p^.location);
                        p^.location.loc:=LOC_FLAGS;
                        p^.location.resflags:=flags;
                        cmpop:=false;
@@ -1284,7 +1284,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.15  1998-10-08 17:17:10  pierre
+  Revision 1.16  1998-10-09 08:56:21  pierre
+    * several memory leaks fixed
+
+  Revision 1.15  1998/10/08 17:17:10  pierre
     * current_module old scanner tagged as invalid if unit is recompiled
     + added ppheap for better info on tracegetmem of heaptrc
       (adds line column and file index)

+ 6 - 1
compiler/cg386cal.pas

@@ -789,6 +789,8 @@ implementation
                    p^.methodpointer^.location.loc:=LOC_REGISTER;
                    p^.methodpointer^.location.register:=R_ESI;
                    p^.methodpointer^.resulttype:=p^.symtable^.defowner;
+                   { change dispose type !! }
+                   p^.disposetyp:=dt_mbleft_and_method;
                    { make a reference }
                    new(r);
                    reset_reference(r^);
@@ -1457,7 +1459,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.33  1998-10-06 17:16:39  pierre
+  Revision 1.34  1998-10-09 08:56:22  pierre
+    * several memory leaks fixed
+
+  Revision 1.33  1998/10/06 17:16:39  pierre
     * some memory leaks fixed (thanks to Peter for heaptrc !)
 
   Revision 1.32  1998/10/01 09:22:52  peter

+ 6 - 1
compiler/cg386mat.pas

@@ -73,6 +73,7 @@ implementation
                   exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,newreference(p^.left^.location.reference),
                     hreg1)));
                 end;
+              clear_location(p^.left^.location);
               p^.left^.location.loc:=LOC_REGISTER;
               p^.left^.location.register:=hreg1;
            end
@@ -171,6 +172,7 @@ implementation
            { this registers are always used when div/mod are present }
          usedinproc:=usedinproc or ($80 shr byte(R_EAX));
          usedinproc:=usedinproc or ($80 shr byte(R_EDX));
+         clear_location(p^.location);
          p^.location.loc:=LOC_REGISTER;
          p^.location.register:=hreg1;
       end;
@@ -559,7 +561,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.7  1998-09-17 09:42:17  peter
+  Revision 1.8  1998-10-09 08:56:24  pierre
+    * several memory leaks fixed
+
+  Revision 1.7  1998/09/17 09:42:17  peter
     + pass_2 for cg386
     * Message() -> CGMessage() for pass_1/pass_2
 

+ 6 - 1
compiler/cg386set.pas

@@ -422,6 +422,8 @@ implementation
                 end;
              end;
           end;
+          if (p^.right^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
+            ungetiftemp(p^.right^.location.reference);
        end;
 
 
@@ -785,7 +787,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  1998-10-08 17:17:14  pierre
+  Revision 1.19  1998-10-09 08:56:25  pierre
+    * several memory leaks fixed
+
+  Revision 1.18  1998/10/08 17:17:14  pierre
     * current_module old scanner tagged as invalid if unit is recompiled
     + added ppheap for better info on tracegetmem of heaptrc
       (adds line column and file index)

+ 6 - 2
compiler/files.pas

@@ -319,7 +319,8 @@ unit files;
          begin
            Freemem(buf,maxbufsize);
            buf:=nil;
-           is_macro:=false;
+           {is_macro:=false;
+           still needed for dispose in scanner PM }
            closed:=true;
            exit;
          end;
@@ -1006,7 +1007,10 @@ unit files;
 end.
 {
   $Log$
-  Revision 1.55  1998-10-08 23:28:54  peter
+  Revision 1.56  1998-10-09 08:56:26  pierre
+    * several memory leaks fixed
+
+  Revision 1.55  1998/10/08 23:28:54  peter
     * -vu shows unit info, -vt shows tried/used files
 
   Revision 1.54  1998/10/08 17:17:19  pierre

+ 6 - 9
compiler/pmodules.pas

@@ -721,7 +721,8 @@ unit pmodules;
                    if current_module^.compiled then
                      begin
                         { this unit symtable is obsolete }
-                        dispose(unitst,done);
+                        { dispose(unitst,done);
+                        disposed as localsymtable !! }
                         exit;
                      end;
                    unitst^.symtabletype:=globalsymtable;
@@ -786,13 +787,6 @@ unit pmodules;
 
          if current_module^.compiled then
            begin
-              { this unit symtable is obsolete }
-              dispose(unitst,done);
-              { avoid self recursive destructor call !! PM }
-              aktprocsym^.definition^.localst:=nil;
-              { absence does not matter here !! }
-              aktprocsym^.definition^.forwarddef:=false;
-              dispose(st,done);
               exit;
            end;
 
@@ -1076,7 +1070,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.63  1998-10-08 23:29:01  peter
+  Revision 1.64  1998-10-09 08:56:28  pierre
+    * several memory leaks fixed
+
+  Revision 1.63  1998/10/08 23:29:01  peter
     * -vu shows unit info, -vt shows tried/used files
 
   Revision 1.62  1998/10/08 17:17:25  pierre

+ 5 - 1
compiler/ptconst.pas

@@ -391,6 +391,7 @@ unit ptconst;
                    else if is_constcharnode(p) then
                      s:=char(byte(p^.value))
                    else Message(cg_e_illegal_expression);
+                   disposetree(p);
                    l:=length(s);
                    for i:=Parraydef(def)^.lowrange to Parraydef(def)^.highrange do
                      begin
@@ -511,7 +512,10 @@ unit ptconst;
 end.
 {
   $Log$
-  Revision 1.16  1998-09-24 23:49:18  peter
+  Revision 1.17  1998-10-09 08:56:29  pierre
+    * several memory leaks fixed
+
+  Revision 1.16  1998/09/24 23:49:18  peter
     + aktmodeswitches
 
   Revision 1.15  1998/09/07 18:46:11  peter

+ 6 - 3
compiler/scanner.pas

@@ -137,8 +137,8 @@ implementation
 
     const
       { use any special name that is an invalid file name to avoid problems }
-      macro_special_name = '__##&&Macro&&##__';
-
+      macro_special_name = '____Macro____';
+      
     procedure create_tokenidx;
     { create an index with the first and last token for every possible token
       length, so a search only will be done in that small part }
@@ -1449,7 +1449,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.59  1998-10-08 23:29:05  peter
+  Revision 1.60  1998-10-09 08:56:31  pierre
+    * several memory leaks fixed
+
+  Revision 1.59  1998/10/08 23:29:05  peter
     * -vu shows unit info, -vt shows tried/used files
 
   Revision 1.58  1998/10/08 17:17:30  pierre

+ 5 - 4
compiler/temp_gen.pas

@@ -95,9 +95,7 @@ unit temp_gen;
 {$endif}
               hp:=templist;
               templist:=hp^.next;
-{$ifndef EXTDEBUG}
               dispose(hp);
-{$endif not EXTDEBUG}
            end;
          templist:=nil;
          tmpfreelist:=nil;
@@ -183,7 +181,7 @@ unit temp_gen;
          tl^.persistant:=false;
          templist:=tl;
 {$ifdef EXTDEBUG}
-         tl^.line:=current_scanner^.line_no;
+         tl^.line:=aktfilepos.line;
 {$endif}
          gettempofsize:=ofs;
       end;
@@ -451,7 +449,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.3  1998-07-16 08:01:42  pierre
+  Revision 1.4  1998-10-09 08:56:32  pierre
+    * several memory leaks fixed
+
+  Revision 1.3  1998/07/16 08:01:42  pierre
     * small bug correction due to newinput
       (only with tempdebug conditionnal)