+2

How memory is managed in Python? 

I wonder how python manages it's memory and is it as efficient as C language.

4/1/2020 10:57:04 AM

Kagha

1 Answer

New Answer

+1

It is important to understand that the management of the Python heap is performed by the interpreter itself and that the user has no control over it, even if they regularly manipulate object pointers to memory blocks inside that heap. The allocation of heap space for Python objects and other internal buffers is performed on demand by the Python memory manager through the Python/C API functions listed in this document. Memory Interface: -void* PyMem_Malloc(size_t n) -void* PyMem_Realloc(void *p, size_t n) -void PyMem_Free(void *p) -etc.... for more information open this link. https://docs.python.org/2/c-api/memory.html