Python + Numpy: When is it useful to manually collect garbage?

I read that you can manually collect garbage using

gc.collect()

Now I wonder when this is useful. I believe this is to some extent a common Python logic. Say I have a large cycle, and in each cycle large matrices will be used Zand rewritten them again and again. Is it useful to remove matrices and collect garbage at the end if I don't resize Z?

The general question . Under what circumstances can one actually observe the effects of forced garbage collection, especially with a large number of numerical calculations within numpy?

+4
source share
1 answer

As you can see in the comments, the easiest way to free memory is del arrayand let the garbage collector do its job.

0
source

Source: https://habr.com/ru/post/1614753/


All Articles