Leakage vs Cyclops

Robin Becker robin at jessikat.fsnet.co.uk
Fri Jan 3 11:04:39 EST 2003


Hi I've a question relating to leakage. A user says his 40000 page
document is using large amounts of memory even when he splits it into
bite size chunks.

I dummy tested with the code below and the output of the cyclops tests
seem to indicate that no obvious cycles are being created. Even so my
resource usage seems to increase monotonically.

My first thoought was that one or more of our extensions could be the
cause, but they are only accelerators and aren't required. The resources
increase with or without them.

With upper limit of 900 pages the peak working set is 15M with 2700 it
rises to 45M. This seems to be a real leak, but how can I track it down? 

I used Cyclops to great effect in the past, but has it lost its touch
with GC or 2.2? I'm using Python 2.2.2 with win32.  



###############################################
from reportlab.lib.styles import ParagraphStyle
from reportlab.platypus import *
def main():
        i = 0
        story = []
        for x in xrange(100,900):
                story.append(Paragraph(str(x),ParagraphStyle('normal')))
                story.append(PageBreak())
                if i % 100==0:
                        fn = "test_%03d.pdf"%i
                        SimpleDocTemplate(fn).build(story)
                        print 'Build',fn
                        story = []
                i += 1
        if story:
                fn = "test_%03d.pdf"%i
                SimpleDocTemplate(fn).build(story)
                print 'Build',fn
                story = []

if __name__=='__main__':
        import Cyclops
        z = Cyclops.CycleFinder()
        z.run(main)
        z.find_cycles(purge_dead_roots=0)
        z.show_stats()
        z.show_cycles()
###############################################

C:\Tmp\ttt>t1.py
Build test_000.pdf
Build test_100.pdf
Build test_200.pdf
Build test_300.pdf
Build test_400.pdf
Build test_500.pdf
Build test_600.pdf
Build test_700.pdf
Build test_800.pdf
**********************************************************************
# objects in root set: 20447
# distinct structured objects reachable: 38529
# distinct structured objects in cycles: 0
# cycles found: 0
# cycles filtered out: 0
# strongly-connected components: 0
# arcs examined: 183782
**********************************************************************
# all cycles:

-- 
Robin Becker




More information about the Python-list mailing list