+ 2

How memory is managed in Python

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

1st Apr 2020, 10:57 AM
Zepush
1 Réponse
+ 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
2nd Apr 2020, 12:12 AM
Ahmed Draz
Ahmed Draz - avatar