#31 memory leak

closed-invalid
None
5
2005-02-27
2005-02-21
No

Every call of docutils Publisher.publish() leak a copy
of the Writer and one of the Reader. There are two
places where a reference to the writer and to the
reader are acquired and never released:

1. in Publisher.apply_transforms() that keep a
reference to the writer and to the reaeder in
document.transforsm. My quik and dirty solution was to add

del document.transform

after

document = self.reader.read(self.source, self.parser,
self.settings)
self.apply_transforms(document)

in core.py line 195.

2. in OptionParser.__init__() there is a piece of code
like:

self.components = (self,) + tuple(components)

that build another circular reference. In this way
OptionParser (that keep a reference to writer and
reader) is never destroied. My quik and dirty fis was
to add

del self.components

at the and of the __init__() function in frontend.py
line 486.

Related to the last there is another problem with
optparse library bundled with python 2.4 that has itsel
a bug that make a circular reference that prevent the
destruction of an optparse.OptionParser object. Filled
as
https://sourceforge.net/tracker/index.php?func=detail&aid=1145594&group_id=38019&atid=421097

Discussion

  • Daniele Nicolodi

    • summary: memoty leak --> memory leak
     
  • Felix Wiemann

    Felix Wiemann - 2005-02-27

    Logged In: YES
    user_id=1014490

    Python's garbage collector should take care of this.

    If you want to ensure cyclic references are cleaned up after
    running Docutils functions, call gc.collect(). This should
    destroy all circular garbage.

    If anything's left *after* calling gc.collect() (i.e. if
    there's referenced garbage left), that would be a bug indeed.

     
  • Felix Wiemann

    Felix Wiemann - 2005-02-27
    • assigned_to: nobody --> felixwiemann
    • status: open --> closed-invalid
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks