{"id":13502215,"url":"https://github.com/jmdana/memprof","last_synced_at":"2025-04-10T03:57:01.077Z","repository":{"id":9007739,"uuid":"10761132","full_name":"jmdana/memprof","owner":"jmdana","description":"A memory profiler for Python. As easy as adding a decorator!","archived":false,"fork":false,"pushed_at":"2021-09-14T18:38:40.000Z","size":649,"stargazers_count":128,"open_issues_count":4,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-10T03:56:57.172Z","etag":null,"topics":["memory","profiler","python"],"latest_commit_sha":null,"homepage":"http://jmdana.github.io/memprof/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmdana.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-18T10:53:36.000Z","updated_at":"2025-03-05T13:11:06.000Z","dependencies_parsed_at":"2022-09-12T23:20:59.637Z","dependency_job_id":null,"html_url":"https://github.com/jmdana/memprof","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmdana%2Fmemprof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmdana%2Fmemprof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmdana%2Fmemprof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmdana%2Fmemprof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmdana","download_url":"https://codeload.github.com/jmdana/memprof/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154997,"owners_count":21056542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["memory","profiler","python"],"created_at":"2024-07-31T22:02:06.311Z","updated_at":"2025-04-10T03:57:01.059Z","avatar_url":"https://github.com/jmdana.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"memprof\n=======\n\n``memprof`` is a memory profiler for Python.\n\nIt logs and plots the memory usage of all the variables during the\nexecution of the decorated methods.\n\nInstallation\n------------\n\nStable\n~~~~~~\n\n::\n\n    sudo pip install --upgrade memprof\n\nor ::\n\n    sudo easy_install --upgrade memprof\n\nor (Debian testing/unstable) ::\n\n    sudo apt-get install python-memprof\n       \n\nDevelopment\n~~~~~~~~~~~\n\n::\n\n    git clone git://github.com/jmdana/memprof.git\n    cd memprof\n    sudo python setup.py install\n\nor ::\n\n    sudo pip install git+https://github.com/jmdana/memprof\n\nUsage\n-----\n\nUsing ``memprof`` is as easy as adding a decorator to the methods that\nyou want to profile: ::\n\n    @memprof\n    def foo():\n\nAnd importing the module just by including the line below at the\nbeginning of your Python file: ::\n\n    from memprof import memprof\n\nNow you can run as usual and logfiles with the names of your methods\nwill be created (e.g. ``foo.log``).\n\nGenerating plots\n~~~~~~~~~~~~~~~~\n\nThe logfiles are not very interesting so you might prefer to use the\n``-p``/``--plot`` flag: ::\n\n    python -m memprof --plot \u003cpython_file\u003e\n    python -m memprof -p \u003cpython_file\u003e\n\nWhich, in addition to the logfile, will generate a plot (``foo.png``):\n\n.. figure:: examples/foo.png\n   :alt: Example plot\n\nThe grey bar indicates that the ``foo`` method wasn't running at that\npoint.\n\nThe flag may also be passed as an argument to the decorator: ::\n\n    @memprof(plot = True)\n\nPlease keep in mind that the former takes precedence over the latter.\n\nAdjusting the threshold\n~~~~~~~~~~~~~~~~~~~~~~~\n\nYou may also want to specify a ``threshold``. The value will be the\nminimum size for a variable to appear in the plot (but it will always\nappear in the logfile!). The default value is 1048576 (1 MB) but you can\nspecify a different ``threshold`` (in bytes) with the\n``-t``/``--threshold`` flag: ::\n\n    python -m memprof --threshold 1024 \u003cpython_file\u003e\n    python -m memprof -t 1024 \u003cpython_file\u003e\n\nThe ``threshold`` may also be passed as an argument to the decorator: ::\n\n    @memprof(threshold = 1024)\n\nPlease keep in mind that the former takes precedence over the latter.\n\nmp\\_plot\n~~~~~~~~\n\nIf, after running ``memprof``, you want to change the threshold and\ngenerate a new plot (or you forgot to use the ``-p``/``--plot`` flag\nwith ``memprof``), you don't have to re-run! Just call the command: ::\n\n    mp_plot [-h] [-t THRESHOLD] logfiles [logfiles ...]\n\nand generate the plots again doing something like: ::\n\n    mp_plot -t 128 logfile1.log logfile2.log\n\nor: ::\n\n    mp_plot -t 1024 *.log\n\netc.\n\nContact\n-------\n\nMailing list\n~~~~~~~~~~~~\n\n-  Subscribe by sending a message to memprof+subscribe@googlegroups.com\n-  Once subscribed, you can send emails to memprof@googlegroups.com\n-  List archives at http://groups.google.com/group/memprof\n\n--------------\n\nCopyright 2013-2019, Jose M. Dana\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmdana%2Fmemprof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmdana%2Fmemprof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmdana%2Fmemprof/lists"}