Created
April 24, 2015 06:19
-
-
Save sp3c73r2038/d51ab170267ab53bfd80 to your computer and use it in GitHub Desktop.
Python garbage collection statistics...
This file contains hidden or 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
# -*- 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