When I execute the program below, memory increases very quickly, so I suppose that memory used in the function named "secundary_function" isn't liberate. If I copy the element I append to the list the problem or if I don't use secundary_function
the problem disappears. I'd like to understand why the copy is necessary here and why secundary_function
has an influence on the memory used..
import numpy as np
import time
def main_function(N):
liste_images = []
for i in range(N) :
images = np.zeros((3000,25,25))
time.sleep(0.05)
secundary_function(images)
liste_images.append(images[0])
def secundary_function(images):
conservee = np.arange(len(images))
images[conservee]
main_function(6000)
Thank you for your answers and sorry for my english !