How is memory managed in python?

How is memory managed in python?

- 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.
How do you make a higher order function in Python?
How do you make a higher order function in Python? - A higher-order function accepts one or more functions as input and returns a new function. Sometimes it is required to use function as data........
How to copy an object in Python?
How to copy an object in Python - There are two ways in which objects can be copied in python. Shallow copy and Deep copy........
Methods or attributes of an object in python
Methods or attributes of an object in python - Built-in dir() function of Python ,on an instance shows the instance variables as well as the methods and class attributes defined by the instance's class and all its base classes alphabetically. ......
Post your comment