Skip to content

Instantly share code, notes, and snippets.

@sp3c73r2038
Created April 24, 2015 06:19
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 sp3c73r2038/d51ab170267ab53bfd80 to your computer and use it in GitHub Desktop.
Save sp3c73r2038/d51ab170267ab53bfd80 to your computer and use it in GitHub Desktop.
Python garbage collection statistics...
# -*- coding: utf-8 -*-
import gc
s = {}
for i in gc.get_objects():
_ = str(type(i))
if _ in s:
s[_] += 1
else:
s[_] = 1
def filter(_):
k, v = _
if v > 100:
return (k, v)
for item in map(filter, s.items()):
if item:
print(item[0], item[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment