How is memory managed in python?



How is memory managed in python?..

Answer / chaitanya

Memory management in Python involves a private heap containing all Python objects and data structures. Interpreter takes care of Python heap and that the programmer has no access to it.

The allocation of heap space for Python objects is done by Python memory manager. The core API of Python provides some tools for the programmer to code reliable and more robust program.

Python also has a build-in garbage collector which recycles all the unused memory. When an object is no longer referenced by the program, the heap space it occupies can be freed. The garbage collector determines objects which are no longer referenced by the sprogram frees the occupied memory and make it available to the heap space.

The gc module defines functions to enable /disable garbage collector:

gc.enable() -Enables automatic garbage collection.

gc.disable() - Disables automatic garbage collection.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What is standard output in python?

0 Answers  


What does the list comprehension do?

0 Answers  


What is pop in python?

0 Answers  


What does the ‘yield’ keyword do?

0 Answers  


What is a Lambda form? Explain about assert statement?

1 Answers  






Should I learn r or python?

0 Answers  


How to import a module given the full path?

0 Answers  


Can a constructor be static?

0 Answers  


Write a sorting algorithm for a numerical dataset in python.

0 Answers  


Explain the use of decorators?

0 Answers  


What are the key features of Python?

0 Answers  


Write a program to convert all strings in list to integers?

0 Answers  


Categories