Skip to main content

Inspect memory usage of python functions

Features

  • Thread handling

  • External tool, doesn’t require code modification

Check memspector --help for command line options

Installation

via pip: pip install memspector

Example

example.py:

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:

example.py:b()                                               thread: main_thread
total memory       diff
    2,940,336     -1,799,976
    2,040,440       -900,048

example.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,048

example.py                                                   thread: main_thread
total memory       diff
    1,133,832        906,232

Bugs

Bugs or suggestions? Visit the issue tracker

License

Memspector
Copyright (C) 2015 Adam Tauber <asciimoo@gmail.com>

This 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 <http://www.gnu.org/licenses/>.

Metadata

Release files for memspector 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memspector 0.1.2
File Size Uploaded Provenance
memspector-0.1.2.tar.gz 3.7 kB Without provenance Details

Release files / memspector-0.1.2.tar.gz

Download URL memspector-0.1.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a5e8434465a47e9fb6baa62077283393d3f20c337c60cb055e885198baa8986d
BLAKE2b-256 checksum
How to use checksums
2db1a6a89d336bb4d5cf6939d48c5b0b944dba10a83c5cd94fe7c1d5dbe88209
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for memspector 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file No provenance

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page