Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/denis-ryzhkov/mem_top
Shows top suspects for memory leaks in your Python program.
https://github.com/denis-ryzhkov/mem_top
Last synced: 3 months ago
JSON representation
Shows top suspects for memory leaks in your Python program.
- Host: GitHub
- URL: https://github.com/denis-ryzhkov/mem_top
- Owner: denis-ryzhkov
- License: mit
- Created: 2014-05-26T18:13:31.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-07-13T15:38:17.000Z (over 2 years ago)
- Last Synced: 2024-11-15T03:39:00.363Z (3 months ago)
- Language: Python
- Size: 12.7 KB
- Stars: 77
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python-testing - mem_top - shows top suspects for memory leaks in your Python program. (Memory Management)
README
# mem_top
Shows top suspects for memory leaks in your Python program.
## Usage
pip install mem_top
from mem_top import mem_top# From time to time:
logging.debug(mem_top())
# print(mem_top())# Notice which counters keep increasing over time - they are the suspects.
## Counters
`mem_top` iterates all objects found in memory and calculates:
* refs - number of direct references from this object to other objects, like keys and values of dict
* E.g. a dict `{("some", "complex", "key"): "value"}` will have `refs: 2` - 1 ref for key, 1 ref for value
* Its key `("some", "complex", "key")` will have `refs: 3` - 1 ref per item
* bytes - size of this object in bytes
* types - number of objects of this type still kept in memory after garbage collection## Real life example
refs:
144997 defaultdict(, { {'.:..............:.......': {...
1578 {...
968 {...
968 {...
968 {...
767 [...
726 {...
608 {...types:
292499
217912
72702
72702
12340
MIT License