Skip to content Skip to sidebar Skip to footer

Python Memory Limit

So clearly there cannot be unlimited memory in Python. I am writing a script that creates lists of dictionaries. But each list has between 250K and 6M objects (there are 6 lists).

Solution 1:

If you have that many objects you need to store, you need store them on disk, not in memory. Consider using a database.

If you import the sys module you will have access to the function sys.getsizeof(). You will have to look at each object of the list and for each dictionary compute the value for every key. For more on this see this previous question - In-memory size of a Python structure.

Post a Comment for "Python Memory Limit"