[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
a memory leak in the Python library
From: |
Chris Brannon |
Subject: |
a memory leak in the Python library |
Date: |
Sat, 31 Jul 2010 05:18:27 -0500 |
It turns out that SSIPClient objects can't be garbage-collected, when
they use the default callback handler. I'll explain the problem, and
I'll send a patch later.
Say that we have an SSIPClient object named sc.
sc._conn refers to some _SSIPConnection object, which we'll name
our_conn. The default callback for our_conn is one of sc's bound
methods: sc._callback_handler.
When sc.close() returns successfully, sc._conn still refers to
our_conn, and our_conn._callback still refers to one of sc's methods.
It's a circular reference, and sc can't be garbage-collected.
The solution is to simply execute
del self._conn
at the end of SSIPClient.close(). I think this is completely safe.
-- Chris
- a memory leak in the Python library,
Chris Brannon <=