aryan singh
aryan singh

Reputation: 161

How to release memory after pickle.load(file_)

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.

Upvotes: 1

Views: 668

Answers (1)

SultanOrazbayev
SultanOrazbayev

Reputation: 16571

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

Upvotes: 1

Related Questions