Carl Zheng
Carl Zheng

Reputation: 718

Clear cache or memory in Python

I have a really large table need to calculate (10 billion + rows). It's too long to calculate all of them at one time. Therefore, I create a list of break points, and I calculate and store at the end of each step. However, each step costs longer time. I think the reason is the memory or cache, do you have any idea how to deal with in this situation or just how to clear cache or memory?

I reuse the variable for output in the loop, so the variable will not become bigger and bigger.

Thank you so much.

Upvotes: 12

Views: 94845

Answers (1)

Camilo
Camilo

Reputation: 397

I use to solve this issue using a line that reset the variable at the end of the process, cleaning the cache:

MyVariable = None

Upvotes: 8

Related Questions