Sunday 1:10 p.m.–1:40 p.m. in Grand Ballroom A

There and Back Again: Disable and re-enable garbage collector at Instagram

Zekun Li


Python's cyclic garbage collector wonderfully hides the complexity of memory management from the programmer. But we pay the price in performance. Ever wondered how that works? In this talk, you'll learn how garbage collection is designed in Python, what the tradeoffs are and how Instagram battled copy-on-write memory issues by disabling the garbage collector entirely. You'll also learn why that isn't such a great idea after all and how we ended up extending the garbage collector API which allowed us to (mostly) re-enable garbage collection. We'll discuss our upstream contributions to the garbage collector that landed in Python 3.6 and 3.7. This is an in-depth talk about memory management but no prior experience with CPython internals is necessary to follow it.