[reportlab-users] Re: Generating huge reports and memory consumption
Robin Becker
reportlab-users@reportlab.com
Fri, 3 Jan 2003 17:11:23 +0000
In article <oqd6ne2rr4.fsf@titan.progiciels-bpi.ca>, François Pinard
<pinard@iro.umontreal.ca> writes
OK Francois, I tried this dummy test
###############################################
from reportlab.lib.styles import ParagraphStyle
from reportlab.platypus import *
def main():
i = 0
story = []
for x in xrange(100,300):
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__':
from ressources import rapporter
rapporter('Report 1')
main()
rapporter('Report 2')
###############################################
Report 1
.......
0 + 3 references to tempfile.TemporaryFileWrapper
Build test_000.pdf
Build test_100.pdf
Build test_200.pdf
Report 2
4 + 2 references to reportlab.pdfbase.pdfmetrics.Font
4 + 2 references to reportlab.pdfbase.pdfmetrics.TypeFace
3 + 1 references to reportlab.lib.sequencer.Sequencer
3 + 1 references to reportlab.pdfbase.pdfmetrics.Encoding
So I don't seem to have a lot hanging about.
When I change the upper limit to 900 I see
.....
Build test_800.pdf
Report 2
4 + 2 references to reportlab.pdfbase.pdfmetrics.Font
4 + 2 references to reportlab.pdfbase.pdfmetrics.TypeFace
3 + 1 references to reportlab.lib.sequencer.Sequencer
3 + 1 references to reportlab.pdfbase.pdfmetrics.Encoding
so only the same things are hanging about. Even so, when I check the
memory usage it still increases with total page count.
--
Robin Becker