Last active
December 13, 2015 23:19
-
-
Save vkosh/4990611 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
# -*- coding: utf-8 -*- | |
import gc | |
import objgraph | |
import tornado | |
import tornado.httpclient | |
def main(): | |
client = tornado.httpclient.HTTPClient() | |
try: | |
client.fetch('http://127.0.0.1:60000') # connection refused | |
except: | |
pass | |
finally: | |
client.close() | |
gc.collect() | |
objs = objgraph.by_type('_HTTPConnection') | |
if objs: | |
objgraph.show_backrefs(objs[0], filename='backref.png') | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment