functional tests leak memory

Bug #251273 reported by Marius Gedminas on 2008-07-23
Affects Status Importance Assigned to Milestone
Zope 3
Fix Released

Bug Description

All functional tests in Zope-3-based apps leak memory by keeping references to all in-memory databases created for each test. This was observed with 3.4.1.

FunctionalTestSetup.setUp() calls multi_database which registers the new database object as a global utility providing IDatabase. The utility registry doesn't automatically remove overriden registrations, it always adds to them.
The object graph keeping the DB objects in memory after running 5 functional tests can be seen at

The fix is to unregister the IDatabase utilities in FunctionalTestSetup.tearDown(). I'm attaching a tested patch.

Marius Gedminas (mgedmin) wrote :
Marius Gedminas (mgedmin) wrote :

Some numbers: on an app I've got here with ~250 functional tests, this patch reduces test runner's memory usage from 500 megs down to 110 megs, and reduces the test run time from 29 minutes down to 21 minutes.

Marius Gedminas (mgedmin) wrote :

Fix committed in rev 88823.

I'd like to release 3.4.3 with this fix.

Changed in zope3:
status: New → Fix Committed
Marius Gedminas (mgedmin) wrote :

Fix released in 3.4.3.

Changed in zope3:
status: Fix Committed → Fix Released
Marius Gedminas (mgedmin) wrote :

I'd like to get this into the KGS as well, but apparently I don't have scp access to

Stephan Richter (srichter) wrote :

On Friday 25 July 2008, Marius Gedminas wrote:
> I'd like to get this into the KGS as well, but apparently I don't have
> scp access to
> /controlled-packages.cfg

Darn. I am back in the office on Monday and will try to debug this with you
and Jim.

Stephan Richter
Web Software Design, Development and Training
Google me. "Zope Stephan Richter"

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers