#5 PDFGraphics failure when rendering + 150 pages

open
nobody
None
5
2003-08-22
2003-08-22
Chris McCarty
No

Team,

I wanted to inform you of a memory leak that I found
within the PDFGraphics Class.

I am working on a project that initially led me to render 1
to 10 page PDF documents (which did not produce any
problems). The memory leak surfaced once I started
producing PDF documents that contained somewhere
between 150 & 200 pages.

In the getFontMetrics() method, a "Dummy" Frame is
created followed by addModify(). Even though the Frame
is created within the method and should be garbage
collected soon thereafter, the parent Graphics object
still has a reference to it. The parent Graphic object
eventually starts handing out null FontMetrics.

I added removeNotify() right before the return
statement int the getFontMetrics() method and not only
did the problem go away, but the PDF document was
rendered quicker than ever before.

Thanks for the package - i've been throwing a ton of
work at this package and overall it's easy and renders
reliably.

Chris

Discussion