PEP 445: explain why External Libraries and Memory Allocators sections are present

This commit is contained in:
Victor Stinner 2013-07-01 23:15:45 +02:00
parent e1d30cc03e
commit 06c2d930d6
1 changed files with 13 additions and 3 deletions

View File

@ -639,9 +639,11 @@ same custom allocator or hook for different Python allocators.
In C++, the context can be used to pass *this*.
External libraries
External Libraries
==================
Examples of API used to customize memory allocators.
Libraries used by Python:
* OpenSSL: `CRYPTO_set_mem_functions()
@ -672,11 +674,15 @@ Other libraries:
<http://docs.oracle.com/cd/B10501_01/appdev.920/a96584/oci15re4.htm>`_,
pass an opaque pointer
The new *ctx* parameter of this PEP was inspired by the API of zlib and
Oracle's OCI libraries.
See also the `GNU libc: Memory Allocation Hooks
<http://www.gnu.org/software/libc/manual/html_node/Hooks-for-Malloc.html>`_.
<http://www.gnu.org/software/libc/manual/html_node/Hooks-for-Malloc.html>`_
which uses a different approach to hook memory allocators.
Memory allocators
Memory Allocators
=================
The C standard library provides the well known ``malloc()`` function.
@ -727,6 +733,10 @@ Other allocators:
<https://developer.gnome.org/glib/unstable/glib-Memory-Slices.html>`_:
efficient way to allocate groups of equal-sized chunks of memory
This PEP permits to choose exactly which memory allocator is used for your
application depending on its usage of the memory (number of allocation, size of
allocations, lifetime of objects, etc.).
Links
=====