python 可以做内存管理吗
发布网友
发布时间:2022-05-02 22:21
我来回答
共1个回答
热心网友
时间:2022-04-18 03:49
Python中的内存管理是通过包含所有Object和数据结构的私有堆来实现的。而对私有堆的控制和管理有Python memory manager 实现。
At the lowest level, a raw memory allocator ensures that there is enough room in the private heap for storing all Python-related data by interacting with the memory manager of the operating system.
On top of the raw memory allocator, several object-specific allocators operate on the same heap and implement distinct memory management policies adapted to the peculiarities of every object type.
The Python memory manager thus delegates some of the work to the object-specific allocators, but ensures that the latter operate within the bounds of the private heap.
Python中对堆得管理是通过解释器本事来实现的。用户并没有权利控制它,即使他能够直接将对象的指针指向某个内存块,但是对堆空间的分配实际由pytho的内存管理器通过Python/C的API函数来实现。
详细资料可以查询:http://blog.csdn.net/carolzhang8406/article/details/6100327