How to release memory after pickle.load(file_)
Question:
I have to load multiple pickle files and do some work on them, I am getting a memory error.
Is there a way to release the memory after pickle.load?
My pickle file is gpickle, I have to load it and do some operations on it, once loaded I don’t really need the loaded pickle file once the data inside it has been read.
Answers:
One possibility is to del
the object after it’s not needed, rough pseudocode:
data1 = pickle.load(pickle_file1)
# do some work
del data1
data2 = pickle.load(pickle_file2)
# do some work
del data2
I have to load multiple pickle files and do some work on them, I am getting a memory error.
Is there a way to release the memory after pickle.load?
My pickle file is gpickle, I have to load it and do some operations on it, once loaded I don’t really need the loaded pickle file once the data inside it has been read.
One possibility is to del
the object after it’s not needed, rough pseudocode:
data1 = pickle.load(pickle_file1)
# do some work
del data1
data2 = pickle.load(pickle_file2)
# do some work
del data2