[Python-checkins] peps: PEP 445: background

victor.stinner python-checkins at python.org
Tue Jun 18 02:02:44 CEST 2013


http://hg.python.org/peps/rev/708d5a17a989
changeset:   4938:708d5a17a989
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jun 18 02:02:27 2013 +0200
summary:
  PEP 445: background

files:
  pep-0445.txt |  21 ++++++++++++++-------
  1 files changed, 14 insertions(+), 7 deletions(-)


diff --git a/pep-0445.txt b/pep-0445.txt
--- a/pep-0445.txt
+++ b/pep-0445.txt
@@ -409,13 +409,20 @@
 
 The heap is handled by ``brk()`` and ``sbrk()`` system calls on Linux, and is
 contiguous.  Memory mappings are handled by ``mmap()`` on UNIX and
-``VirtualAlloc()`` on Windows, they are discontiguous. Releasing a memory
-mapping gives back the memory immediatly to the system. For the heap, memory is
-only gave back to the system if it is at the end of the heap. Otherwise, the
-memory will only gave back to the system when all the memory located after the
-released memory are also released. This limitation causes an issue called the
-"memory fragmentation": the memory usage seen by the system may be much higher
-than real usage.
+``VirtualAlloc()`` on Windows, they may be discontiguous.
+
+Releasing a memory mapping gives back immediatly the memory to the system. For
+the heap, memory is only given back to the system if it is at the end of the
+heap. Otherwise, the memory will only be given back to the system when all the
+memory located after the released memory are also released. To allocate memory
+in the heap, the allocator tries to reuse free space. If there is no contiguous
+space big enough, the heap must be increased, even if we have more free space
+than required size.  This issue is called the "memory fragmentation": the
+memory usage seen by the system may be much higher than real usage.
+
+CPython has a pymalloc allocator using arenas of 256 KB for allocations smaller
+than 512 bytes. This allocator is optimized for small objects with a short
+lifetime.
 
 Windows provides a `Low-fragmentation Heap
 <http://msdn.microsoft.com/en-us/library/windows/desktop/aa366750%28v=vs.85%29.aspx>`_.

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list