Skip to content

Instantly share code, notes, and snippets.

@vkosh
Last active December 13, 2015 23: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 vkosh/4990611 to your computer and use it in GitHub Desktop.
Save vkosh/4990611 to your computer and use it in GitHub Desktop.
# -*- 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