in reply to Re^2: Memory and garbage collection
in thread Memory and garbage collection

Linux has the philosophy "if you need free memory, put it beside your PC". Or in other words, it buffers as much as it can, and doesn't show the buffered as "free" just for the sake of having free memory available.

For example it caches all files read from disk, like your script, the perl interpreter, modules and other data files. So after you run a perl program linux will say it has less free memory. But if you need the memory, it clears the caches and makes that memory available.

So after running a perl program, or any kind of program, you can have less free memory than before, but you have no loss whatsoever.

Try running the same program 20 times in row. Memory usage shouldn't increase for each run, just for the first one.