-
-
Save mastro35/f9bf71edf8cf3deb2f60a7e8102032e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def get_elements(): | |
elements = [] | |
for i in range (0,10000): | |
elements.append("x"*10240) | |
# return a list of 10.000 items, each of 10KB... | |
return elements | |
characters_count = 0 | |
my_elements=get_elements() | |
# in this moment, our program has a memory footprint of more than 100MB!!! | |
for i in my_elements: | |
characters_count = characters_count + len(i) | |
print(characters_count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment