Patchwork [Ada] Free memory used for computing checksum (gnatmake -m)

login
register
mail settings
Submitter Arnaud Charlet
Date June 17, 2010, 1:01 p.m.
Message ID <20100617130108.GA30904@adacore.com>
Download mbox | patch
Permalink /patch/56041/
State New
Headers show

Comments

Arnaud Charlet - June 17, 2010, 1:01 p.m.
When gnatmake is called with switch -m, memory allocated to get the
checksum of a fie is now reclaimed, to avoid allocating too much
memory when there are many source files with time stamp mismatches.
No easy test.

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-06-17  Vincent Celier  <celier@adacore.com>

	* make.adb (Check): If switch -m is used, deallocate the memory that
	may be allocated when computing the checksum.

Patch

Index: make.adb
===================================================================
--- make.adb	(revision 160905)
+++ make.adb	(working copy)
@@ -1785,6 +1785,13 @@  package body Make is
 
          Modified_Source := Time_Stamp_Mismatch (ALI, Read_Only);
 
+         --  To avoid using too much memory when switch -m is used, free the
+         --  memory allocated for the source file when computing the checksum.
+
+         if Minimal_Recompilation then
+            Sinput.P.Clear_Source_File_Table;
+         end if;
+
          if Modified_Source /= No_File then
             ALI := No_ALI_Id;