I had a C++ program that I was running within a bash script, and I wanted to see if the program was leaking memory, so I did valgrind ./doTheThing.sh
and it reported 12 bytes of memory leaked. I figured my program wasn't structured well, so I made some changes, tried again, and still the same 12 bytes of memory were being leaked. After I tried enough different things to make the C++ program not leak memory and getting the exact same leak, I tried making the program malloc 100,000 bytes and then exit and...12 bytes of memory leaked. Then I ran the program on its own outside of the script and the memory leaks showed up in ways that actually made sense.
So the problem was running valgrind on a bash script. Is this because valgrind wasn't meant to be used on bash scripts and glitches in a way that makes it look like it leaks 12 bytes of memory? Or do bash scripts inherently leak 12 bytes of memory every time they run?