Clear memory in python loop -
how can clear memory in python loop ?
import concurrent.futures futures futures.threadpoolexecutor(max_workers=100) executor: fs = [executor.submit(get_data, url) url in link] i, f in enumerate(futures.as_completed(fs)): x= (f.result()) results.append(x) del x del f
get_data - simple function wich using requests
i think had same problem recently, answer not del introducing sleep func... try;
import time import concurrent.futures futures futures.threadpoolexecutor(max_workers=100) executor: fs = [executor.submit(get_data, url) url in link] i, f in enumerate(futures.as_completed(fs)): x= (f.result()) results.append(x) time.sleep(n_seconds)
or (i used while loop on list of urls)
Comments
Post a Comment