bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash 5 increase in RAM from loop with many interations that append to fi


From: Scott Kostyshak
Subject: Bash 5 increase in RAM from loop with many interations that append to file
Date: Tue, 27 Oct 2020 00:11:11 -0400
User-agent: NeoMutt/20200925-17-dd27f5

The following example uses more peak RAM on new bash versions than old versions:

for i in {1..1000000}; do
  echo "${i}" >> example.txt
done

By measuring peak memory usage with time (/usr/bin/time -f "%E %P %M"),
I get that newer versions of Bash use about 284M, where older versions
use about 191M.

Is this perceived increase in memory usage worth looking more into or is
it intended?

I tried to bisect but I'm not sure the result is useful. I got the following:

  d233b485e83c3a784b803fb894280773f16f2deb is the first bad commit
  commit d233b485e83c3a784b803fb894280773f16f2deb
  Author: Chet Ramey <chet.ramey@case.edu>
  Date:   Mon Jan 7 09:27:52 2019 -0500
  
      bash-5.0 distribution sources and documentation

Thank you to Chet and to everyone for their time working on Bash!

Scott



reply via email to

[Prev in Thread] Current Thread [Next in Thread]