summaryrefslogtreecommitdiffstats
path: root/Doc/library/sys.rst
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-12-09 13:28:26 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-12-09 13:28:26 (GMT)
commitf9d0b1256fd5a9ae90fa8e8418bd450ec6b7f5f2 (patch)
treefd5ad7ad717440f4586652180cb31a3cf2e52e97 /Doc/library/sys.rst
parentb4b8f234d4407492c4493e3a16bc8263139c7869 (diff)
downloadcpython-f9d0b1256fd5a9ae90fa8e8418bd450ec6b7f5f2.zip
cpython-f9d0b1256fd5a9ae90fa8e8418bd450ec6b7f5f2.tar.gz
cpython-f9d0b1256fd5a9ae90fa8e8418bd450ec6b7f5f2.tar.bz2
Issue #13390: New function :func:`sys.getallocatedblocks()` returns the number of memory blocks currently allocated.
Also, the ``-R`` option to regrtest uses this function to guard against memory allocation leaks.
Diffstat (limited to 'Doc/library/sys.rst')
-rw-r--r--Doc/library/sys.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index c327f21..ee1f2b2 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -393,6 +393,20 @@ always available.
.. versionadded:: 3.1
+.. function:: getallocatedblocks()
+
+ Return the number of memory blocks currently allocated by the interpreter,
+ regardless of their size. This function is mainly useful for debugging
+ small memory leaks. Because of the interpreter's internal caches, the
+ result can vary from call to call; you may have to call
+ :func:`_clear_type_cache()` to get more predictable results.
+
+ .. versionadded:: 3.4
+
+ .. impl-detail::
+ Not all Python implementations may be able to return this information.
+
+
.. function:: getcheckinterval()
Return the interpreter's "check interval"; see :func:`setcheckinterval`.