summaryrefslogtreecommitdiffstats
path: root/software/python.page
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2022-06-23 10:35:06 -0700
committerbnewbold <bnewbold@robocracy.org>2022-06-23 10:35:06 -0700
commitc1def3cdf5569c892a75e84b8b23963371f3819d (patch)
tree225060a76fa55fd8e224c643e4cd7e3d88995505 /software/python.page
parent5be0eb7d31d792366eb1e1be0a6de477a348b723 (diff)
parent9eff4d99afc1ba861ae32dcd46d88ff6b3ef222f (diff)
downloadknowledge-c1def3cdf5569c892a75e84b8b23963371f3819d.tar.gz
knowledge-c1def3cdf5569c892a75e84b8b23963371f3819d.zip
Merge branch 'master' of adze:knowledge
Diffstat (limited to 'software/python.page')
-rw-r--r--software/python.page21
1 files changed, 21 insertions, 0 deletions
diff --git a/software/python.page b/software/python.page
index 0fd2531..0fc3c8d 100644
--- a/software/python.page
+++ b/software/python.page
@@ -205,3 +205,24 @@ and create a `pytest.ini` like:
norecursedirs = .svn _build tmp*
Need to mock? <https://blog.fugue.co/2016-02-11-python-mocking-101.html>
+
+Debugging Memory Usage
+------------------------
+
+Most helpful tools I found were `psutil` and `pympler` (both need to be
+installed).
+
+ import os, psutil
+ process = psutil.Process(os.getpid())
+ print(process.memory_info().rss)
+ # ... do some stuff ...
+ print(process.memory_info().rss)
+
+and
+
+ from pympler import tracker
+ tr = tracker.SummaryTracker()
+ tr.print_diff()
+
+ # ... do some stuff ...
+ tr.print_diff()