79662016

Date: 2025-06-11 12:49:44
Score: 1
Natty:
Report link

There has been multiple reports of matplotlib.animation.FuncAnimation having memory leaks with one example being: Memory leak with FuncAnimation and matshow. #19561 where the cause is related to the C-language implementation. They do post comments that adding the repeat=False to FuncAnimation solves the problem.

If that doesnt work (I cant reproduce your fault since i dont have the csv-files) I woul like to inform you of the following:

Your call to gc.Collect() doesnt work as you intend since the garbage Collector only disposes of variables that are not referenced anymore. So even if you call gc.Collect() a hundred times, you wont collect "items" that are still referenced. This is the case with your line agg_by_week = get_data(counter).

When you are calling gc.Collect() you are still referencing the data by having the reference: agg_by_week. If you want to explicitly delete that reference so that it is possible to be collected, use the delkeyword e.g.:

del agg_by_week

more information about the del-keyword can be found Here

Reasons:
  • Blacklisted phrase (1): doesnt work
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Hygdrasil