Fixing Memory Leaks in Popular Python Libraries

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • CPython

    The Python programming language

  • As far as I know, the only errors that you're supposed to "except: pass" from socket.shutdown are OSErrors. I think you want anything else (if it even throws anything else?) to be fatal.

    This is the same way cpython handles it: https://github.com/python/cpython/blob/b56774bd93822e1598bb5...

  • celery

    Distributed Task Queue (development branch)

  • If either shutdown (or close) raises an exception, self.sock isn't set to None. Thus Python retains the reference.

    https://github.com/celery/celery/issues/4843#issuecomment-99...

    Another way you can have leaks with a reference counting GC is through circular references. Python provides WeakRef for such situations, but it's up to the programmer to use it correctly.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • py-amqp

    amqplib fork

  • I tested your theory on this branch of py-amqp: https://github.com/pawl/py-amqp/commit/45f5eef6f650daaaf662d...

    It still leaks if you don't close the socket.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts