diff options
author | Christian Heimes <christian@cheimes.de> | 2008-02-04 18:00:12 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-02-04 18:00:12 (GMT) |
commit | 422051a3675271e179995ad4a0f056ff94395d55 (patch) | |
tree | 3316e9503901082cc4beefbf169d8191c9838190 /Doc/library/sys.rst | |
parent | a26cf9b7609fc1c08fd1a69ddf5e44dc98a70dce (diff) | |
download | cpython-422051a3675271e179995ad4a0f056ff94395d55.zip cpython-422051a3675271e179995ad4a0f056ff94395d55.tar.gz cpython-422051a3675271e179995ad4a0f056ff94395d55.tar.bz2 |
Patch #1953
I implemented the function sys._compact_freelists() and C API functions PyInt_/PyFloat_CompactFreeList() to compact the pre-allocated blocks of ints and floats. They allow the user to reduce the memory usage of a Python process that deals with lots of numbers.
The patch also renames sys._cleartypecache to sys._clear_type_cache
Diffstat (limited to 'Doc/library/sys.rst')
-rw-r--r-- | Doc/library/sys.rst | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 7c88251..17e3890 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -58,9 +58,29 @@ always available. A string containing the copyright pertaining to the Python interpreter. -.. function:: _cleartypecache() +.. function:: _compact_freelists() - Clear the internal type lookup cache. + Compact the free lists of integers and floats by deallocating unused blocks. + It can reduce the memory usage of the Python process several tenth of + thousands of integers or floats have been allocated at once. + + The return value is a tuple of tuples each containing three elements, + amount of used objects, total block count before the blocks are deallocated + and amount of freed blocks. The first tuple refers to ints, the second to + floats. + + This function should be used for specialized purposes only. + + .. versionadded:: 2.6 + + +.. function:: _clear_type_cache() + + Clear the internal type cache. The type cache is used to speed up attribute + and method lookups. Use the function *only* to drop unnecessary references + during reference leak debugging. + + This function should be used for internal and specialized purposes only. .. versionadded:: 2.6 |