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 Torsten Erler <er...@net-linx.de> on 2002/05/15 11:23:00 UTC

garbage collection on reset

Hi all!

Can I (and if yes, how can I) configure the MEM_PROFILE_WITH_GC variable on
StreamRenderer to run garbage collector every start and finish to save
memory on batch printing?

Additional, please take a look on FopImageFactory. This class holds strong
references to every loaded image.
No reload and recalculate the dimension of the image (which has modified
since the last loading) is possible at any time. This is the cause why
modified images are scaled to the size of the first loaded image on
awt/print rendering.
I've overriden the class to disable the caching complete (Batch printing
uses 500++ MB!!! memory usage after loading 20 to 30 images and it crashes
due to OutOfMemoryError).
I don't know whether this is fixed in your current project status, if yes
ignore this.

ThanX Torsten

P.S.: ThanX to all, who spend a lot of time to make this powerful program
more stable and more extensive. I think this and of course the other apache
projects, are a great contribution to bring java ( my favorite ) to the most
popular and most useful programming language.


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


RE: garbage collection on reset

Posted by Keiron Liddle <ke...@aftexsw.com>.
Hi,

It sounds like you need the implementation of caching that is in the cvs
development.
It will be possible to specify different caching methods and to cache
with a context (eg. per document).
It also releases images (to a weak hashmap) after the renderer is
finished with them.



On Wed, 2002-05-15 at 13:56, Torsten Erler wrote:
> Hi
> 
> The workflow is following:
> 
> - I create many images like file://c:/a/1/temp.gif, file://c:/a/2/temp.gif
> and file://c:/a/3/temp.gif
> - I add the path's to my xml structured document
> - I transform this document and an accordingly xsl to and tmp.fo file
> - this fo-file will be rendered for print-preview via an AWTRenderer
> Subclass
> - I call reset on Driver, my renderer and set new inputsource etc.
> 
> On batch printing this workflow repeats x-times and for every rendering
> process the image-files will be created in the same way. That means,
> independant on how many gifs I've to produce for the current preview, all
> files are located in folder "a" and all files are named temp.gif. Only the
> directory which holds the file is (incremetal) different, but starts for
> each preview with "1". After the preview is done the directory file://c:/a
> and all child files will be removed from the computer.
> 
> The first Preview works correct, but if I try to go the same way more than
> one times, all following AWT-rendered Images are scaled to the size
> calculated to the first loading of file://c:/a/1/temp.gif ...., but the size
> and contents of the file has changed completely.
> 
> The FopImageFactory maps the String representation of the image URL to the
> calculated FOPImage. On request it returns the wrong FOPImage, because of no
> check for last modified date ore something is done. That means the ImageArea
> which is constructed on rendering process has the wrong dimensions.
> AWTRenderer's renderImageArea(ImageArea) method loads the correct (actual)
> image from the URL and the direct drawing from Graphics2D will scale the
> image into the shape-dimensions of the obsolete FOPImage.
> The results are funny if the first picture has a dimesion of 100x800 points
> and the second one (with exactly the same url) has 600x200 points.
> 
> Hope that helps
> 
> cu Torsten



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


RE: garbage collection on reset

Posted by Torsten Erler <er...@net-linx.de>.
Hi

The workflow is following:

- I create many images like file://c:/a/1/temp.gif, file://c:/a/2/temp.gif
and file://c:/a/3/temp.gif
- I add the path's to my xml structured document
- I transform this document and an accordingly xsl to and tmp.fo file
- this fo-file will be rendered for print-preview via an AWTRenderer
Subclass
- I call reset on Driver, my renderer and set new inputsource etc.

On batch printing this workflow repeats x-times and for every rendering
process the image-files will be created in the same way. That means,
independant on how many gifs I've to produce for the current preview, all
files are located in folder "a" and all files are named temp.gif. Only the
directory which holds the file is (incremetal) different, but starts for
each preview with "1". After the preview is done the directory file://c:/a
and all child files will be removed from the computer.

The first Preview works correct, but if I try to go the same way more than
one times, all following AWT-rendered Images are scaled to the size
calculated to the first loading of file://c:/a/1/temp.gif ...., but the size
and contents of the file has changed completely.

The FopImageFactory maps the String representation of the image URL to the
calculated FOPImage. On request it returns the wrong FOPImage, because of no
check for last modified date ore something is done. That means the ImageArea
which is constructed on rendering process has the wrong dimensions.
AWTRenderer's renderImageArea(ImageArea) method loads the correct (actual)
image from the URL and the direct drawing from Graphics2D will scale the
image into the shape-dimensions of the obsolete FOPImage.
The results are funny if the first picture has a dimesion of 100x800 points
and the second one (with exactly the same url) has 600x200 points.

Hope that helps

cu Torsten

> -----Original Message-----
> From: Arved Sandstrom [mailto:Arved_37@chebucto.ns.ca]
> Sent: Mittwoch, 15. Mai 2002 12:29
> To: fop-dev@xml.apache.org; erlto@net-linx.de
> Subject: RE: garbage collection on reset
>
>
> Hi, Torsten
>
> All points are noted.
>
> I am not sure I understand what you want to see in the case
> of modified
> images. In the general case, as soon as you change the dimension of an
> image, you might potentially have to recalculate _all_
> layout. The rendering
> cannot independently start using a new image size.
>
> I think I am missing something. Can you describe this scenario in more
> detail? It sounds like a good use case.
>
> Regards,
> Arved Sandstrom
>
> > -----Original Message-----
> > From: Torsten Erler [mailto:erlto@net-linx.de]
> > Sent: May 15, 2002 6:23 AM
> > To: Fop-Dev (E-mail)
> > Subject: garbage collection on reset
> >
> > Can I (and if yes, how can I) configure the MEM_PROFILE_WITH_GC
> > variable on
> > StreamRenderer to run garbage collector every start and
> finish to save
> > memory on batch printing?
> >
> > Additional, please take a look on FopImageFactory. This
> class holds strong
> > references to every loaded image.
> > No reload and recalculate the dimension of the image (which
> has modified
> > since the last loading) is possible at any time. This is
> the cause why
> > modified images are scaled to the size of the first loaded image on
> > awt/print rendering.
> > I've overriden the class to disable the caching complete
> (Batch printing
> > uses 500++ MB!!! memory usage after loading 20 to 30 images
> and it crashes
> > due to OutOfMemoryError).
> > I don't know whether this is fixed in your current project
> status, if yes
> > ignore this.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>


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


RE: garbage collection on reset

Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
Hi, Torsten

All points are noted.

I am not sure I understand what you want to see in the case of modified
images. In the general case, as soon as you change the dimension of an
image, you might potentially have to recalculate _all_ layout. The rendering
cannot independently start using a new image size.

I think I am missing something. Can you describe this scenario in more
detail? It sounds like a good use case.

Regards,
Arved Sandstrom

> -----Original Message-----
> From: Torsten Erler [mailto:erlto@net-linx.de]
> Sent: May 15, 2002 6:23 AM
> To: Fop-Dev (E-mail)
> Subject: garbage collection on reset
>
> Can I (and if yes, how can I) configure the MEM_PROFILE_WITH_GC
> variable on
> StreamRenderer to run garbage collector every start and finish to save
> memory on batch printing?
>
> Additional, please take a look on FopImageFactory. This class holds strong
> references to every loaded image.
> No reload and recalculate the dimension of the image (which has modified
> since the last loading) is possible at any time. This is the cause why
> modified images are scaled to the size of the first loaded image on
> awt/print rendering.
> I've overriden the class to disable the caching complete (Batch printing
> uses 500++ MB!!! memory usage after loading 20 to 30 images and it crashes
> due to OutOfMemoryError).
> I don't know whether this is fixed in your current project status, if yes
> ignore this.


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