I have a long running python program that logs to a file.
I start program and let it run in the background
python my-process.py >> /var/log/my_log.log 2>&1 &
The free memory slowly declines until logrotate rotates the log file. Memory is freed up, and the process repeats itself.
Does the free memory decline because when I append (>>
) to the log file, it keeps the entire log file in memory?
I imagine adding a maxsize
property to my logrotate config will keep memory freed up, but I'm also wondering if there is a better way to handle this.
my_log.log
is rotated, I'm leaning toward it being an issue of the logfile being kept in memory