[Python-Dev] refleak hunting season

Michael Hudson mwh at python.net
Tue Aug 3 12:03:54 CEST 2004


Neal Norwitz <neal at metaslash.com> writes:

> On Mon, Aug 02, 2004 at 03:39:36PM +0100, Michael Hudson wrote:
>> 
>> test_sax leaked [1899, 1899, 1899, 1899] references
>>     no idea -- scary numbers, though!
>
> It looks like the worst (only?) leakers are:
>
>         test_expat_incomplete
>         test_expat_inpsource_location

Yes.  The rest are all caused by the module level variable items
containing it's old value...

> Both of these cause exceptions to be raised.  I don't know the pyexpat
> code at all.  But I think I fixed a few leaks with the attached patch.

I certainly agree with your patch to set_error_attr (I had the same).
Also, I think one needs to decref 'err' in set_error (PyErr_SetObject
increfs its arguments).

> Some leaks were caught by the tests, but I doubt all were. 

Probably not :-/

> The patch is a starting point if anyone else wants to give it a
> shot.  If not, I'll add it to SF or review carefully and check in
> later.

Well, it seems Fred wants a look.  I'll attach my diffs to pyexpat.c
to the report (there's another fairly obvious leak exposed by
test_minidom).

Cheers,
mwh

-- 
  > I'm a little confused.
  That's because you're Australian!  So all the blood flows to
  your head, away from the organ most normal guys think with.
                        -- Mark Hammond & Tim Peters, comp.lang.python


More information about the Python-Dev mailing list