Does bash run a garbage collector? Can it be controlled via some command line options? I can’t find anything on the net about this.
I have a bash script that runs and over a few days its memory usage increases. I want to know where the memory is going.
Bash does not run a garbage collector as such. Since it has no concept of references, there is no need to find data without references. It does free memory no longer in use, though.
Here’s a simple demonstration of memory usage before and after declaring and overwriting a large variable. Memory usage goes up then down again: