[reportlab-users] Generating huge reports and memory consumption
Robin Becker
reportlab-users@reportlab.com
Fri, 3 Jan 2003 19:11:44 +0000
In article <200301031838.53009.pradu@pradu.it>, Alessandro Praduroux
<pradu@pradu.it> writes
......
>**********************************************************************
># objects in root set: 184091
># distinct structured objects reachable: 350224
># distinct structured objects in cycles: 0
># cycles found: 0
># cycles filtered out: 0
># strongly-connected components: 0
># arcs examined: 2206833
>>>> z.show_cycles()
>**********************************************************************
># all cycles:
..... seems to be indicating that no cyclic memory is left hanging
>> From the fragment you give it seems as though the story isn't being
>> reset, but I may be missing something.
>>
>after the build(), I checked and self.Story was empty. I believe build()
>"consumes" the story
>
.... yes you're right the flowables are del'ed off the front of the list
in the main handle_flowable method.
>> Can you say which constructs are being used?
>>
>This is what I do to build each page of the story:
>
> lines = text.split('\n')
> self.Story.append(Spacer(1,4.5*cm))
> for l in lines:
> p = Paragraph(l,self.style)
> self.Story.append(p)
> self.Story.append(Spacer(1,0.2*cm))
> self.Story.append(PageBreak())
> print ".",
>
>and this is what I do as static decoration of each page:
>
> canvas.saveState()
> x = cm
> y = A4[1] - cm * 3
>
> # print the header and signature
> canvas.drawImage(self.imhead, cm * 2,A4[1] - cm * 4.0, A4[0] - cm * 4,
>cm * 2.5)
> canvas.drawImage(self.imsign, A4[0] - cm * 9.5, cm*5.5, 130,35)
>
> #footer separation line
> canvas.line(x,cm*2.6,A4[0] - x,cm*2.6)
>
> # footer
> w = canvas.stringWidth("some text",'Times-Roman',8)
> canvas.drawString((A4[0] - w) / 2,cm*line,"some text")
>
> w = canvas.stringWidth("some text",'Times-Roman',8)
> canvas.drawString((A4[0] - w) / 2,cm*line,"some text")
>
>
....... nothing weird there. As you say even with my simple tests no
apparent leakage, but the win32 memory creeps up with total page count.
--
Robin Becker