summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2017-04-03 12:42:37 +0200
committerJulian Taylor <jtaylor.debian@googlemail.com>2017-04-28 17:09:24 +0200
commit03534ec90dba2bcdcd649be64be57939dde4c6f5 (patch)
tree62b83ff8615e3b604e548e1040f76cd888377f15 /tools
parentd5657b9e29a8e00ad8e074bc32c15dec220d766f (diff)
downloadpython-numpy-03534ec90dba2bcdcd649be64be57939dde4c6f5.tar.gz
python-numpy-03534ec90dba2bcdcd649be64be57939dde4c6f5.tar.bz2
python-numpy-03534ec90dba2bcdcd649be64be57939dde4c6f5.zip
ENH: add support for python3.6 memory tracing
Python 3.6 added a private API for tracing arbitrary memory allocations so the tracemalloc module [0] can be used with numpy. closes gh-4663 [0] https://docs.python.org/3/library/tracemalloc.html
Diffstat (limited to 'tools')
-rw-r--r--tools/allocation_tracking/README.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/allocation_tracking/README.md b/tools/allocation_tracking/README.md
new file mode 100644
index 000000000..fd4f2c871
--- /dev/null
+++ b/tools/allocation_tracking/README.md
@@ -0,0 +1,11 @@
+Example for using the `PyDataMem_SetEventHook` to track allocations inside numpy.
+
+`alloc_hook.pyx` implements a hook in Cython that calls back into a python
+function. `track_allocations.py` uses it for a simple listing of allocations.
+It can be built with the `setup.py` file in this folder.
+
+Note that since Python 3.6 the builtin tracemalloc module can be used to
+track allocations inside numpy.
+Numpy places its CPU memory allocations into the `np.lib.tracemalloc_domain`
+domain.
+See https://docs.python.org/3/library/tracemalloc.html.