Memory management in Python

Click for: original source

This article describes memory management in Python 3.6. If you are interested in GC details, you can read my article about Garbage collection in Python. By Artem Golubin.

Everything in Python is an object. Some objects can hold other objects, such as lists, tuples, dicts, classes, etc. Because of dynamic Python’s nature, such approach requires a lot of small memory allocations. To speed-up memory operations and reduce fragmentation Python uses a special manager on top of the general-purpose allocator, called PyMalloc.

The content of article:

  • Small object allocation
  • Block
  • Pool
  • Arena
  • Memory deallocation

Note: Python’s small object manager rarely returns memory back to the Operating System. Great read!

[Read More]

Tags python programming software app-development apis