denis-ryzhkov / mem_top

Shows top suspects for memory leaks in your Python program.
MIT License
77 stars 9 forks source link

Refs and types #7

Closed ndvbd closed 2 years ago

ndvbd commented 4 years ago

Hi Denis, can you plz explain the difference between refs and types?

You wrote "refs - number of direct references from this object to other objects, like keys and values of dict" - what do you mean by "this object"? What object?

For example, how do you read this output of refs:

refs:
1546    <type 'dict'> {'email.MIMEAudio': <email.LazyImporter object at 0x7fa3cf8a7850>, 'numpy.core.info': <module 'numpy
1367    <type 'list'> ['"""``tornado.gen`` implements generator-based coroutines.\n', '\n', '.. note::\n', '\n', '   The "
1348    <type 'list'> ['websocket', 'thread', 'websocket', 'create_connection', 'WebSocket', 'timeit', 'timer', 'default_t
1342    <type 'list'> ['"""Implementation of the WebSocket protocol.\n', '\n', '`WebSockets <http://dev.w3.org/html5/webso
1267    <type 'list'> ['#\n', '# Copyright 2009 Facebook\n', '#\n', '# Licensed under the Apache License, Version 2.0 (the
1242    <type 'dict'> {'disp': <function disp at 0x7fa3d13d0d50>, 'union1d': <function union1d at 0x7fa3d11a7550>, 'all': 
denis-ryzhkov commented 2 years ago

Hi @ndvbd! Sorry for huge delay: notifications were disabled for some reason. Thank you for raising this issue. I tried to make the docs more clear by adding this example:

Counters

mem_top iterates all objects found in memory and calculates: