Really Python leaks?

Barry A. Warsaw barry at
Thu Jul 19 06:37:49 CEST 2001

>>>>> "DC" == Dave Cole <djc at> writes:

    DC> I know that my extension modules leak a bit due to objects
    DC> which are created when the module is imported and stick around
    DC> for the lifetime of the module.  I had not given it much
    DC> thought.

I don't think such allocs should be considered leaks worth worrying
about, if they're leaks at all.  If there's a good reason for those
objects to stick around for the life of the module, then you might as
well let the normal process shutdown free them implicitly.  I don't
believe Python will dlclose your extension module even on a reload
(assuming it's a dynamic library; if it's statically compiled, you
won't get finalized anyway until the process exits).


More information about the Python-list mailing list