Hi Dominik, This could well be a bug, akin to the issue dealt with here https://issues.apache.org/bugzilla/show_bug.cgi?id=49060
Pete On Mon, Jul 19, 2010 at 9:53 AM, Dominik Stadler <[email protected]> wrote: > Hi, > > > > my use-case is to have FOP integrated into a larger server application, > where FOP is only executed sporadically. > > > > We already evaluated running FOP externally, but had severe trouble doing so > for various reasons. Therefore we need to try to keep memory usage of FOP as > low as possible when it is not running, I already had to do some workarounds > to keep FOP from storing memory in caches or in thread locals, partly also > the XML implementation from Sun interferes and keeps the whole FOP SAX > Handler as thread local. Also any intermediate files need to be removed when > FOP is finished rendering, something that caused me a bit of headache last > week. > > > > I have one final item that I just found and would like to get input if there > is a better solution: > > The FOUserAgent holds an element “imageSessionContext” which holds > SoftReferences to Source/ImageSource elements via > AbstractImageSessionContext.sessionSources. The memory for these items is > cleaned correctly when we un-reference the FOUserAgent object, however the > Source-items still hold a file-handle via the InputStream that is included > in StreamSource/ImageStreamSource object. The effect is that I cannot remove > intermediate image files that are used during PDF generation, but would like > to delete after the PDF is created. > > > > Currently I employ an ugly hack where I remember the file-names and > afterwards use FOUserAgent.getImageSessionContext().getSource() to retrieve > the Source and do the “close()” on the item manually. > > > > - Is this a bug, as file handles are kept open this way and are > only given up, when the SoftReference is collected? So this can easily cause > “out of handle” type of errors if a lot of memory is available and thus > SoftReferences are not collected for a long time. > > - Is there a way to not keep these references in the first run? I > use different images throughout the document, so image caching is not very > useful for me anyway. > > > > Thanks… Dominik. > > > > Dominik Stadler, Team Lead > F +43 732 210100008 | E [email protected] | Skype: > stadler.dominik > > dynaTrace is Continuous APM >> Monitor. Resolve. Prevent. >> > > Web: http://www.dynatrace.com | Blog: http://blog.dynatrace.com > > Learn about dynaTrace in 2 minutes | Forrester rates dynaTrace “On Fire”. > Get your copy of the report here. > > This e-mail message, including any attachments, is confidential and may > contain legally privileged information. This message is intended solely for > the use of the addressee. Use by others is prohibited. Disclosure, copying > and distribution of this information to third parties is not permitted. If > you have received this message in error, please notify us immediately and > delete it from your system. The integrity and security of this message > cannot be guaranteed and it may be subject to data corruption, interception > and unauthorized amendment, for which we accept no liability. > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
