Not enough memory? How does python optimize memory

For the C language, memory leaks are a very common accident, so you should pay special attention to the release of useless memory when writing code , but for pythoner, you generally don't care about these, because python will manage memory by itself.

But recently I encountered a problem. I am writing a program that will take up a lot of memory. I first used a collection to store data.

Like the following

example_set = set()
for i in range(10000000):
    example_set.add

Guess you like

Origin blog.csdn.net/weixin_35770067/article/details/130705520