Re: Image caching issue in FOP 0.20.5

On Feb 25, 2009, at 16:14, <A.Jha@xxxxxxxxxxxxxx> <A.Jha@xxxxxxxxxxxxxx> wrote:


We are generating different images for every user. For example we
generate a image (company logo) but a separate copy for all users. Hence
if there are 10 users generating PDF , will have 10 images of company
Is this a reason for memory leakage?

Well, it's only a real 'leakage' if there are multiple copies of *identical* images (and 'identical' means they have the exact same URI). If the logo is made available at a central location (= 10 times the same image with the same URI), you should always have one and only one copy of it in memory. If every user has his own copy, each with a different URI, then you can have 10 or 100 times the 'same' image. There is no real way for FOP to know that two images are the same, other than comparing the binaries. FOP assumes that an identical URI points to the same image (can be an issue when you generate temporary images but use the same URL every time).

As far as I remember from 0.20.5, Manuel has offered you the only possible way to clear the cache after a rendering run.

How can it be resolved?
By upgrading to higher version of FOP?

Upgrading to the latest version of FOP (0.95) should change things drastically, due to the complete rework of image-loading (which has been extracted from the FOP codebase, and is now made available under XMLGraphics Commons). IIRC, the new image-loading framework uses Java SoftReferences, so images that aren't used anymore will eventually be released automatically.



To unsubscribe, e-mail: fop-users-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: fop-users-help@xxxxxxxxxxxxxxxxxxxxxx