[reportlab-users] Generating huge reports and memory consumption
Robin Becker
reportlab-users@reportlab.com
Fri, 3 Jan 2003 15:13:49 +0000
In article <200301031506.15211.pradu@pradu.it>, Alessandro Praduroux
<pradu@pradu.it> writes
>
>Hi all
>
.....This is clearly of interest. There used to be something written by
Tim Peters to detect cycles. I think it's called Cyclops.py and it may
help. If you can't locate it I will post it.
>From the fragment you give it seems as though the story isn't being
reset, but I may be missing something.
Can you say which constructs are being used?
I tried the following which seems to indicate no cycles. Even so I see
the memory creeping up
################################
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()
################################
And get
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