Skip to content

Instantly share code, notes, and snippets.

@WoZ
Created March 12, 2012 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WoZ/2024604 to your computer and use it in GitHub Desktop.
Save WoZ/2024604 to your computer and use it in GitHub Desktop.
import resource
iterations = 10000000
data = {}
for i in xrange(0, iterations):
data['iteration' + str(i)] = []
memoryUsed = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024.0
print "Memory used: ", str(round(memoryUsed, 2)) + 'MB'
# prints "Memory used: 1648.18MB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment