Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/asciimoo/memspector
Inspect memory usage of python functions
https://github.com/asciimoo/memspector
Last synced: 3 days ago
JSON representation
Inspect memory usage of python functions
- Host: GitHub
- URL: https://github.com/asciimoo/memspector
- Owner: asciimoo
- Created: 2015-09-20T16:29:53.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-22T09:34:09.000Z (about 9 years ago)
- Last Synced: 2024-10-16T12:21:17.819Z (18 days ago)
- Language: Python
- Size: 124 KB
- Stars: 181
- Watchers: 9
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
- starred-awesome - memspector - Inspect memory usage of python functions (Python)
README
Memspector
==========Inspect memory usage of python functions
Features
~~~~~~~~- Thread handling
- External tool, doesn't require code modificationCheck ``memspector --help`` for command line options
Installation
~~~~~~~~~~~~via pip: ``pip install memspector``
Example
~~~~~~~``example.py``:
.. code-block:: python
l = []
def a():
l.extend(range(100000))def b():
global l
l = []a()
a()
b()
a()
b()
a()Run ``memspector example.py`` to get the following output:
.. code-block::
example.py:b() thread: main_thread
total memory diff
2,940,336 -1,799,976
2,040,440 -900,048example.py:a() thread: main_thread
total memory diff
1,139,848 900,400
2,040,280 900,000
1,140,408 900,048
1,140,408 900,048example.py thread: main_thread
total memory diff
1,133,832 906,232Bugs
~~~~Bugs or suggestions? Visit the `issue tracker `__
License
~~~~~~~.. code-block::
Memspector
Copyright (C) 2015 Adam TauberThis program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.See .