[Python-Dev] patch-finalizer vs Zope3

Tim Peters tim at zope.com
Thu Nov 4 18:19:54 CET 2004


FYI, and without taking time for non-trivial analysis.  I ran the non-ZEO
Zope3 tests with a Python patched to treat weakrefs with callbacks as
reachable (this was patch-finalizer.txt, attached to a msg I sent to
python-dev last night).

The first test to leave stuff in gc.garbage then:

    The following test left garbage:
    test_created (bugtracker.browser.tests.test_bug.BugBaseViewTest)
    65

where 65 is len(gc.garbage) after the test finished.  From there it climbed
steadily.  By the time the functional tests ended, the Python process was
about 575MB, and gc.garbage contained 324,056 weakrefs.

I haven't investigated why it happens, but that it *does* happen in an app
that believes it's well-behaved suggests that "practicality beats purity"
would win in the end (i.e., no matter how elegant the approach, if it's too
hard to live with, it won't fly).

Of course nothing is left in gc.garbage here under 2.3.4 or 2.4b2, or under
2.4b2 + patch-callback.  Under the latter, the Python process tops out at
about 150MB.

These were all with debug builds of Python, so process sizes are
substantially larger than with release builds (the object header is 2
pointers bigger in a debug build, and every object gotten via pymalloc grows
16 debug pad bytes, and everything gotten via PyMem_XYZ() gets pymalloc
debug padding too).



More information about the Python-Dev mailing list