On Mar 5, 2008, at 21:09, Puppala, Kumar (LNG-CON) wrote:

Hi Kumar

I ran our server using DevPartner and noticed a lot of memory leaks. After much analysis, I was able to determine that the manner in which we embed FOP in our application (for that matter any application) might be resulting in these leaks. The specific piece of code that I found very interesting is as shown below:

           // Setup JAXP using identity transformer
TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer

Interesting! So the memory leaks are not inherent to FOP it would seem, but to the way the JAXP-pattern is used.


When you use the TransformerFactory in this manner (within each run), the SAXParser instance created by the transformer is held in memory. On subsequent runs, I noticed more and more instances of SAXParser’s in memory. To fix this, I moved this code to the calling function, thus keeping a single copy of transformer.

Makes sense. The TransformerFactory should indeed (better practice) be declared only once. If you ever plan on using XSLT stylesheets, you could also cache a Templates object.

This greatly reduced the GC times. However, I am still seeing an incremental increase rendering times on subsequent runs. I am trying to streamline the code on our end to adhere to your suggestions. If you find anything, please let us know.

First try focusing on reducing the log-messages. Another post of today demonstrated that this helps a lot in increasing the overall processing time.

I currently have only little time to run the tests, but if I do, I'll certainly report back.


Thanks for the feedback!

Cheers

Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to