From 2660b7cfbad710dcd9df26e68c18d6c7d6ebaca0 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 17 May 2021 14:33:16 +0200 Subject: Rework how a build file (Makefile, ...) is produced The memory footprint of how we produced the Makefile was quite... important, because we have all the processing in one perl snippet, and generate the details of the build file by appending to the "magic" variable $OUT. The result is that this variable gets to hold the majority of the build file text, and depending on memory reallocation strategies for strings, the heap may hold multiple (possibly not just a few) copies of this string, almost all of them "freed" but still taking up space. This has resulted in memory exhaustion. We therefore change strategy, and generate the build file in two phases, where the first phase generates the full template using small perl snippets for each detail, and the second phase processes this template. This is much kinder to process memory. Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/15310) --- Configure | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Configure') diff --git a/Configure b/Configure index 2996cd1b4a..cd40abedf7 100755 --- a/Configure +++ b/Configure @@ -1918,9 +1918,7 @@ if ($builder eq "unified") { $config{build_file_templates} = [ cleanfile($srcdir, catfile("Configurations", "common0.tmpl"), $blddir), - $build_file_template, - cleanfile($srcdir, catfile("Configurations", "common.tmpl"), - $blddir) ]; + $build_file_template ]; my @build_dirs = ( [ ] ); # current directory @@ -2789,7 +2787,7 @@ my %template_vars = ( my $configdata_outname = 'configdata.pm'; print "Creating $configdata_outname\n"; open CONFIGDATA, ">$configdata_outname.new" - or die "Trying to create $configdata_outname.new: $!"; + or die "Trying to create $configdata_outname.new: $!"; my $configdata_tmplname = cleanfile($srcdir, "configdata.pm.in", $blddir); my $configdata_tmpl = OpenSSL::Template->new(TYPE => 'FILE', SOURCE => $configdata_tmplname); -- cgit v1.2.1