I wrote a function that logged the process using logging
python package and redirected it to both a file and the ipython console (I'm using Spyder). After a couple of hours, I noticed that the memory increased slowly but surely.
Before the loop, here is my logging initialization block:
##### Initialize logging
log_file='program.log'
logger = logging.getLogger()
logger.handlers=[]
logger.setLevel(logging.INFO)
fh= logging.FileHandler(log_file,mode='w')
sh= logging.StreamHandler()
logger.addHandler(fh)
logger.addHandler(sh)
Then it the main loop I do couples of:
logging.info('Some text')
How can I avoid those memory leaks?