{ "info": { "author": "Max Zheng", "author_email": "maxzheng.os @t gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Software Development" ], "description": "memory-tools\n========================\n\nA set of simple yet effective tools to troubleshoot memory leaks.\n\nWhen debugging memory issues in Python 2.6, the author had tried memory_profiler_ and heapy_,\nunfortunately neither worked. And so memory-tools was born with the goal of being simple - it\nshould always work, yet effective - it is good at helping you find memory leaks.\n\n.. _memory_profiler: https://pypi.python.org/pypi/memory_profiler\n.. _heapy: https://pypi.python.org/pypi/guppy\n\nQuick Start Tutorial\n====================\n\nInstallation\n------------\n\n.. code::\n\n $ pip install memory-tools\n\nShow Memory Usage / Delta\n-------------------------\n\nUse the `show-mem` command to show system or process memory usage. When paired with watch_, this becomes even more useful.\n\nShow system memory::\n\n $ show-mem\n\n Commit Mem (MB): 27,852.80 total 17,278.42 used\n Physical Mem (MB): 16,384.00 total 13,128.05 used\n\nRe-run to show delta from last run::\n\n $ show-mem\n\n Commit Mem (MB): 27,852.80 total 17,888.59 used (delta: 310.15)\n Physical Mem (MB): 16,384.00 total 13,126.40 used (delta: -1.65)\n\nShow memory for process::\n\n $ show-mem -p python\n\n 1 process matching \"python\":\n PID 26143 (MB): 4.79 rss 1.23 private\n\n $ show-mem -p 26143\n\n PID 26143 (MB): 4.80 rss 1.24 private\n\nWatch system/process memory using watch_::\n\n $ watch show-mem -s -p python\n\n Commit Mem (MB): 27,852.80 total 17,888.59 used (delta: 310.15)\n Physical Mem (MB): 16,384.00 total 13,126.40 used (delta: -1.65)\n\n 2 processes matching \"python\" (showing 1st & last):\n PID 26143 (MB): 40.79 rss 30.23 private\n PID 24118 (MB): 4.79 rss 1.23 private\n\nSummarize / Save GC Objects\n---------------------------\n\nAfter running your program, view summary of gc.get_objects()::\n\n from memorytools import summarize_objects\n\n summarize_objects()\n\nAnd here is a sample output::\n\n Objects count 3,790\n Objects size 833,344\n\n Size Count Type\n 476,864 296 \n 76,320 954 \n 64,920 541 \n ...\n\n Count Size Type\n 954 76,320 \n 541 64,920 \n 515 37,080 \n ...\n\nSave all objects (along with the above summary) to a file::\n\n from memorytools import save_objects\n\n save_objects()\n\n # Output: Wrote 3887 objects to /var/tmp/objects-45271 (882040 bytes)\n\n\nLooping / Stress Testing\n------------------------\n\nUse the `loop` command to run a command, module:method, or code in a forever loop to perform stress testing, which is\nuseful in finding memory leaks. The command/code should, of course, act against a long running server for this to be useful.\n\nRun a script in a loop::\n\n $ loop show-mem 1\n\n Physical Mem (MB): 16,384.00 total 9,415.50 used (delta: -190.67)\n Physical Mem (MB): 16,384.00 total 9,415.27 used (delta: -0.23)\n Physical Mem (MB): 16,384.00 total 9,415.85 used (delta: 0.58)\n ^C [ User CTRL-C here as it loops forever by default ]\n Looped 3 times in 2.80 secs\n\nRun a module:method in a loop - count of 10::\n\n $ loop memorytools:summarize_objects 10 -c 10\n\n # Results from summarize_objects() every 10 seconds\n\n Looped 10 times in 100 secs\n\nRun adhoc code in a loop - count of 2 and concurrency of 3::\n\n $ loop 'print(\"Hello World!\")' 0.1 -c 2 -cc 3\n Hello World!\n ... 5 more times\n\n Looped 2 times in 0.21 secs with concurrency of 3 (6 runs, 0.10 secs per loop, 0.03 secs per run)\n\n\nLog Stack / Start Debugger on Signal\n------------------------------------\n\nIf you need to get a stacktrace of a running process, or start the debugger in specific situations to look at memory footprint,\nthen a signal handler could help::\n\n from memorytools import add_debug_handler\n\n add_debug_handler(start_debugger_password='test') # remove start_debugger_password to skip rpdb2 debugger\n\nThe above will add a handler to SIGUSR2 that will log a stacktrace on trigger and also start the rpdb2_ debugger.\n\n.. _rpdb2: http://winpdb.org/docs/embedded-debugging/\n\n\nLinks & Contact Info\n====================\n\n| Documentation: http://memory-tools.readthedocs.org\n|\n| PyPI Package: https://pypi.python.org/pypi/memory-tools\n| GitHub Source: https://github.com/maxzheng/memory-tools\n| Report Issues/Bugs: https://github.com/maxzheng/memory-tools/issues\n|\n| Connect: https://www.linkedin.com/in/maxzheng\n| Contact: maxzheng.os @t gmail.com\n\n.. _watch: https://en.wikipedia.org/wiki/Watch_(Unix)", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/maxzheng/memory-tools", "keywords": "memory tools leaks profiler simple easy to use process usage private rss total", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "memory-tools", "package_url": "https://pypi.org/project/memory-tools/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/memory-tools/", "project_urls": { "Homepage": "https://github.com/maxzheng/memory-tools" }, "release_url": "https://pypi.org/project/memory-tools/1.0.5/", "requires_dist": null, "requires_python": "", "summary": "A set of simple yet effective tools to troubleshoot memory leaks.", "version": "1.0.5" }, "last_serial": 2932664, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "0a895a287dd38be0e6ade0390ea16ea0", "sha256": "de9b17d5bdb3a4a8c32c8125a0486b09db2d2c07357f3dbf48e65586d5c18ca5" }, "downloads": -1, "filename": "memory-tools-1.0.0.tar.gz", "has_sig": false, "md5_digest": "0a895a287dd38be0e6ade0390ea16ea0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16096, "upload_time": "2016-04-05T08:38:29", "url": "https://files.pythonhosted.org/packages/3b/ed/58dd752ed87769632c28e381bbe2dc64dc4947ccabed69634ab24660158a/memory-tools-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "4e6b9f41e8009db2e6ea13555db6e2e1", "sha256": "47f15bbf328a78086756b6929b4471fd0430774d9c9f27438e18d29b039f633c" }, "downloads": -1, "filename": "memory-tools-1.0.1.tar.gz", "has_sig": false, "md5_digest": "4e6b9f41e8009db2e6ea13555db6e2e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16100, "upload_time": "2016-04-05T08:48:56", "url": "https://files.pythonhosted.org/packages/4c/2a/e0e3f026595143e9a8e9faa8c56a0a92fc1565884393377fdb617365614d/memory-tools-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "4b55b2121bf855f6d03b9aec0d55aa63", "sha256": "63465b933786e934913947f0374d735dc1c069b4261c38a63856cd469c47c64a" }, "downloads": -1, "filename": "memory-tools-1.0.2.tar.gz", "has_sig": false, "md5_digest": "4b55b2121bf855f6d03b9aec0d55aa63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16196, "upload_time": "2016-04-06T17:39:44", "url": "https://files.pythonhosted.org/packages/4b/0a/57b84b8068d47cdbb290e931a6273faf779de06afd2140835b84f48c54d7/memory-tools-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "a72adc414c428bfdffcc14238f463670", "sha256": "3e238336b71a57c33c716f745ce80b29654e089580bc085fac16e98f108f1f3c" }, "downloads": -1, "filename": "memory-tools-1.0.3.tar.gz", "has_sig": false, "md5_digest": "a72adc414c428bfdffcc14238f463670", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16329, "upload_time": "2016-07-01T19:36:22", "url": "https://files.pythonhosted.org/packages/cd/27/012584cdd7f9d932552a72452f7df7cfefd5a787c1b91403f37ea379e6b3/memory-tools-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "9c9528090f15639188d918bf6c4d5d3c", "sha256": "d4751eef9368545cb20817f05a3e1566b10294790629a2d75e979dc29b583e93" }, "downloads": -1, "filename": "memory-tools-1.0.4.tar.gz", "has_sig": false, "md5_digest": "9c9528090f15639188d918bf6c4d5d3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16786, "upload_time": "2017-06-05T16:09:16", "url": "https://files.pythonhosted.org/packages/53/6c/d63a7a0db9a04efd05f1e5e58552a50b1118c077b59b878dcdabbf1efab8/memory-tools-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "e3da19d82f973dcf8a3b2b85c1c8d6e4", "sha256": "00980a0317e82e31af8e0b453803b5846a9ad980e14f08dfb0f6b3d695814f66" }, "downloads": -1, "filename": "memory-tools-1.0.5.tar.gz", "has_sig": false, "md5_digest": "e3da19d82f973dcf8a3b2b85c1c8d6e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16368, "upload_time": "2017-06-07T16:05:28", "url": "https://files.pythonhosted.org/packages/a3/fd/f7c7a06db0af64082076890a1a3051caf659ca29f47b4f31ab53db56ff9d/memory-tools-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e3da19d82f973dcf8a3b2b85c1c8d6e4", "sha256": "00980a0317e82e31af8e0b453803b5846a9ad980e14f08dfb0f6b3d695814f66" }, "downloads": -1, "filename": "memory-tools-1.0.5.tar.gz", "has_sig": false, "md5_digest": "e3da19d82f973dcf8a3b2b85c1c8d6e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16368, "upload_time": "2017-06-07T16:05:28", "url": "https://files.pythonhosted.org/packages/a3/fd/f7c7a06db0af64082076890a1a3051caf659ca29f47b4f31ab53db56ff9d/memory-tools-1.0.5.tar.gz" } ] }