You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "J.Pietschmann" <j3...@yahoo.de> on 2003/05/13 20:31:37 UTC

SoftReferencess against memory overflow?

Hi,
what about using a java.lang.ref.SoftReference (JDK 1.2) in
FOP's image chache? Seems to be a small change which may
prevent at least some frustration. Should this still go
into the maintenance branch?

BTW how far got 0.20.5rc3?

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: SoftReferencess against memory overflow?

Posted by Christian Geisert <ch...@isu-gmbh.de>.
J.Pietschmann schrieb:

[..]

> BTW how far got 0.20.5rc3?

Really overdue but I won't have time before sunday

Christian


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: SoftReferencess against memory overflow?

Posted by Jeremias Maerki <de...@greenmail.ch>.
On 18.05.2003 22:23:28 J.Pietschmann wrote:
> J.Pietschmann wrote:
> > what about using a java.lang.ref.SoftReference (JDK 1.2) in
> > FOP's image chache?
> 
> After 2 hours of experimenting (how the heck manage people
> to run out of memory without using forward references??)
> I conclude the fix would be of limited value, because of
> this part of the code in PDFDocument.java:
>          String url = img.getURL();
>          PDFXObject xObject = (PDFXObject)this.xObjectsMap.get(url);
>          if (xObject != null)
>              return xObject.getXNumber();
> and, worse, this code in PDFXObject(int,int,FopImage, PDFDocument):
>         fopimage = img;
> Great: the PDF renderer uses shared PDF objects, and they hold a
> reference to the image object anyway.
> We might get away with nulling the image reference in
> PDFXObject.output(), but the whole thing is...a bit messy.

Maybe. In HEAD this is already done. But I'd prefer if we would add a
method "release()" to PDFObject (initially doing nothing) that could be
called in output methods to release big memory chunks when they are no
longer in use.

> 
> Comments?
> 
> It would be easier for people running FOP in a server because
> they can actually take advantage of FOP's caching, for example
> if the documents all contain the company's logo or other general
> images.
> 
> BTW I like stuff like this (from PDFXObject)
>           if (img == null)
>              MessageHandler.errorln("FISH");
> Duh!

Yeah, there's still a lot of clean-up work to be done.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: SoftReferencess against memory overflow?

Posted by "J.Pietschmann" <j3...@yahoo.de>.
J.Pietschmann wrote:
> what about using a java.lang.ref.SoftReference (JDK 1.2) in
> FOP's image chache?

After 2 hours of experimenting (how the heck manage people
to run out of memory without using forward references??)
I conclude the fix would be of limited value, because of
this part of the code in PDFDocument.java:
         String url = img.getURL();
         PDFXObject xObject = (PDFXObject)this.xObjectsMap.get(url);
         if (xObject != null)
             return xObject.getXNumber();
and, worse, this code in PDFXObject(int,int,FopImage, PDFDocument):
        fopimage = img;
Great: the PDF renderer uses shared PDF objects, and they hold a
reference to the image object anyway.
We might get away with nulling the image reference in
PDFXObject.output(), but the whole thing is...a bit messy.

Comments?

It would be easier for people running FOP in a server because
they can actually take advantage of FOP's caching, for example
if the documents all contain the company's logo or other general
images.

BTW I like stuff like this (from PDFXObject)
          if (img == null)
             MessageHandler.errorln("FISH");
Duh!


J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: SoftReferencess against memory overflow?

Posted by Jeremias Maerki <de...@greenmail.ch>.
Sure, good idea in general but let's stick to bugfixing.

On 13.05.2003 20:31:37 J.Pietschmann wrote:
> what about using a java.lang.ref.SoftReference (JDK 1.2) in
> FOP's image chache? Seems to be a small change which may
> prevent at least some frustration. Should this still go
> into the maintenance branch?
> 
> BTW how far got 0.20.5rc3?


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org