[Twisted-Python] help with refcounts and memleaks

Timothy Fitz TimothyFitz at gmail.com
Fri Jan 6 12:47:54 EST 2006

On 12/26/05, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Mon, 26 Dec 2005 17:07:35 +0100, Andrea Arcangeli <andrea at cpushare.com> wrote:
> >I'd also like to know how other languages like ruby and java behave in
> >terms of self-references of objects. Can't the language understand it's
> >a self reference, and in turn it's the same as an integer or a string,
> >like it already does when the member is initialized statically?
> I don't know Ruby well enough to comment directly, but I believe Ruby's
> GC is much simpler (and less capable) than Python's.  Java doesn't have
> bound methods (or unbound methods, or heck, functions): the obvious way
> in which you would construct them on top of the primitives the language
> does offer seems to me as though it would introduce the same "problem"
> you are seeing in Python, but that may just be due to the influence
> Python has had on my thinking.

(A little late jumping into this discussion) C# (and the CLR in
genral), being the better Java that it is, has dynamic functions in
the form of delegates, which can be "bound methods" in the sense that
Python has them. In addition, it has destructors which are very
similar to python's __del__. The CLR's garbage collector will collect
cycles with destructors, unlike Python. This means that destructors in
C# don't always have access to all of their members (some may
"mysteriously" be null, and no order is guaranteed so it will appear
random) because they've already been collected. To complexify the
matter even more, the CLR's garbage collector may (and in windows
does) run in a seperate thread, making safe robust CLR deconstructors
a fine art.

More information about the Twisted-Python mailing list