• Home
  • Raw
  • Download

Lines Matching full:memory

7 Memory Management
19 Memory management in Python involves a private heap containing all Python
21 internally by the *Python memory manager*. The Python memory manager has
25 At the lowest level, a raw memory allocator ensures that there is enough room in
27 memory manager of the operating system. On top of the raw memory allocator,
29 distinct memory management policies adapted to the peculiarities of every object
32 requirements and speed/space tradeoffs. The Python memory manager thus delegates
38 even if they regularly manipulate object pointers to memory blocks inside that
40 buffers is performed on demand by the Python memory manager through the Python/C
49 To avoid memory corruption, extension writers should never try to operate on
52 calls between the C allocator and the Python memory manager with fatal
54 different heaps. However, one may safely allocate and release memory blocks
68 In this example, the memory request for the I/O buffer is handled by the C
69 library allocator. The Python memory manager is involved only in the allocation
72 In most situations, however, it is recommended to allocate memory from the
74 memory manager. For example, this is required when the interpreter is extended
76 the desire to *inform* the Python memory manager about the memory needs of the
77 extension module. Even when the requested memory is used exclusively for
78 internal, highly-specific purposes, delegating all memory requests to the Python
79 memory manager causes the interpreter to have a more accurate image of its
80 memory footprint as a whole. Consequently, under certain circumstances, the
81 Python memory manager may or may not trigger appropriate actions, like garbage
82 collection, memory compaction or other preventive procedures. Note that by using
83 the C library allocator as shown in the previous example, the allocated memory
84 for the I/O buffer escapes completely the Python memory manager.
89 Memory Interface
94 memory from the Python heap:
100 allocated memory, or *NULL* if the request fails. Requesting zero bytes returns
102 been called instead. The memory will not have been initialized in any way.
107 Resizes the memory block pointed to by *p* to *n* bytes. The contents will be
110 the memory block is resized but is not freed, and the returned pointer is
114 previous memory area.
119 Frees the memory block pointed to by *p*, which must have been returned by a
131 memory. Returns a pointer cast to :c:type:`TYPE\*`. The memory will not have
137 Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n *
139 *p* will be a pointer to the new memory area, or *NULL* in the event of
141 the original value of p to avoid losing memory when handling errors.
148 In addition, the following macro sets are provided for calling the Python memory
163 memory from the Python heap.
165 By default, these functions use :ref:`pymalloc memory allocator <pymalloc>`.
175 allocated memory, or *NULL* if the request fails.
178 if ``PyObject_Malloc(1)`` had been called instead. The memory will not have
184 Resizes the memory block pointed to by *p* to *n* bytes. The contents will be
188 is equal to zero, the memory block is resized but is not freed, and the
195 a valid pointer to the previous memory area.
200 Frees the memory block pointed to by *p*, which must have been returned by a
224 to 512 bytes) with a short lifetime. It uses memory mappings called "arenas"
272 memory API family for a given memory block, so that the risk of mixing different
285 In addition to the functions aimed at handling raw memory blocks from the Python