Opened 14 years ago

Closed 12 years ago

#505 closed defect (fixed)

Memory leak in Python bindings of MatchDecider

Reported by: Joost Cassee Owned by: Richard Boulton
Priority: normal Milestone: 1.2.11
Component: Xapian-bindings (Python) Version: 1.2.3
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description

There seems to be a bug in the Python bindings of the MatchDecider class. Instances are not garbage collected after they have been used in Enquire.get_mset. The attached test case demonstrates the behaviour.

I have reason to believe that the MatchSpy and PostingSource classes have the same problem.

Attachments (2)

testcase-505.py (1.5 KB ) - added by Joost Cassee 14 years ago.
Testcase for ticket 505
testcase-505-fixed.py (1.6 KB ) - added by Olly Betts 14 years ago.
Testcase which doesn't list all the refers to None

Download all attachments as: .zip

Change History (8)

by Joost Cassee, 14 years ago

Attachment: testcase-505.py added

Testcase for ticket 505

comment:1 by Joost Cassee, 14 years ago

Version: 1.2.21.2.3

Tested with 1.2.3.

comment:2 by Olly Betts, 14 years ago

Milestone: 1.2.x

It's possible this could be fixed by upgrading to using newer SWIG. I made a start on doing that, but the director changes broke the PHP bindings.

Marking as milestone:1.2.x for now, as this might get a bit involved.

by Olly Betts, 14 years ago

Attachment: testcase-505-fixed.py added

Testcase which doesn't list all the refers to None

comment:3 by Olly Betts, 14 years ago

The test case passes for me on Python 2.5.2, but then lists all the objects referring to None, which isn't helpful. Fixed testcase attached.

Dan wonders if this is due to gc changes in Python 2.7. It looks like the bindings aren't inherently leaky at least.

comment:4 by Olly Betts, 14 years ago

Oh, and the SWIG upgrade didn't fix this.

comment:5 by Olly Betts, 13 years ago

Testcase passes with Python 2.7 on current trunk (r16253), but I'm unsure what the change is which fixed it - I tried and failed to usefully bisect it with git.

It would be good to address this in 1.2.x, even if it's just differences in garbage collection causing the testsuite to misreport as it currently seems, though that might be tricky if we can't work out what change fixed this.

comment:6 by Olly Betts, 12 years ago

Milestone: 1.2.x1.2.11
Resolution: fixed
Status: newclosed

Works for me with python-xapian 1.2.12 as packaged for Debian (which doesn't have any extra patches) with python 2.6 or python 2.7 on current Debian testing. Also works with python 2.5.2 and current 1.2 branch on atreus. So it seems this has been fixed in 1.2 too now, though I'm not sure exactly what change fixed it (something between 1.2.9 and 1.2.11 inclusive, judging by the date of my previous comment - 1.2.12 had no code changes in the bindings).

I'm going to close this, but if you're still seeing this with 1.2.11 or newer, please reopen (or comment and I'll reopen if you don't get an option to reopen).

Note: See TracTickets for help on using tickets.