You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Henrique de Miranda Gontijo <hg...@nextech.com.br> on 2008/02/14 04:25:27 UTC

Outofmemory using Batik libs

Hi all,
 
I need some help with the problem of out of memory with at jsvgcanvas. At my
viewer, I have a ArrayList() where I put my JSVGCanvas objects. The size of
the ArrayList is the total of pages the document have.
I want to keep five pages in memory. So every time I change this cache, I do
this:
 
/* This for can found the correct pages in memory */
for (int i = currentRange.getStartPage(); i < currentRange.getEndPage() + 1;
i++) {
FVCanvas canvas = (FVCanvas) iterator.getItemAtPosition(i);
canvas.stopProcessing();
canvas.setDocument(null);
canvas.dispose();
}

I also call System.gc() every time I change the page.
Does anybody have any idea why some memory still in use?
 
Thanks,
Henrique.


RE: Outofmemory using Batik libs

Posted by Henrique de Miranda Gontijo <hg...@nextech.com.br>.
Hi,

My viewer makes a cache of 5 pages. After I see a total near to 30 pages
(this depends on the quality of the document) I got the exception.
I had increase the size of memory used by JVM at Internet Explorer before
starting the test. The problem is the quantity of reserved and free memory
by JVM. Every time I get the new 5 pages to my cache, the size of reserved
and used memory increase, and sometimes the size of used memmory decrease.

Thanks,
Henrique.

-----Original Message-----
From: Mikael [mailto:mikael-aronsson@telia.com] 
Sent: quinta-feira, 14 de fevereiro de 2008 04:21
To: batik-users@xmlgraphics.apache.org
Subject: Re: Outofmemory using Batik libs

The generated DOM tree is in ram and this can get pretty huge with big
documents.

Do you get the out of memory when you have all 5 pages filled or does it
take some time before you get the exception ?

There is no need to call System.gc(), but do try to increase memory as
suggested and see if that helps.

Mikael

----- Original Message -----
From: "Tonny Kohar" <to...@gmail.com>
To: <ba...@xmlgraphics.apache.org>
Sent: Thursday, February 14, 2008 6:18 AM
Subject: Re: Outofmemory using Batik libs


> Hi,
>
> On Feb 14, 2008 10:25 AM, Henrique de Miranda Gontijo
> <hg...@nextech.com.br> wrote:
>>
>> I need some help with the problem of out of memory with at jsvgcanvas. At

>> my
>> viewer, I have a ArrayList() where I put my JSVGCanvas objects. The size 
>> of
>> the ArrayList is the total of pages the document have.
>> I want to keep five pages in memory. So every time I change this cache, I

>> do
>> this:
>>
>> /* This for can found the correct pages in memory */
>> for (int i = currentRange.getStartPage(); i < currentRange.getEndPage() +

>> 1;
>> i++) {
>> FVCanvas canvas = (FVCanvas) iterator.getItemAtPosition(i);
>> canvas.stopProcessing();
>> canvas.setDocument(null);
>> canvas.dispose();
>> }
>>
>> I also call System.gc() every time I change the page.
>> Does anybody have any idea why some memory still in use?
>>
>>
>
> I do not know about why some memory still in use. But you can increase
> the memory of your java application by adding -Xmx???m eg: -Xmx256m.
>
> I think the amount of memory used by Batik is less influenced by
> number of pages, but more toward how big and how many element, how
> complex element is the page (the bigger/complex the more memory used,
> although it is only 1 page)
>
> I think batik memory can be divided into:
> - DOM object
> - Renderer result (this is image file)
> - Renderer cache result (this is image file)
> - other things.
>
> it is all added together. Just the renderer result already quite big
> if you have big image resolution (basic calc eg: 1024*768*4(RGBA) +
> other things)
>
> I think Batik maintainer will know better how batik use memory.
>
> Cheers
> Tonny Kohar
> -- 
> Sketsa SVG Editor
> imagine, design, create ...
> http://www.kiyut.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Outofmemory using Batik libs

Posted by Mikael <mi...@telia.com>.
The generated DOM tree is in ram and this can get pretty huge with big 
documents.

Do you get the out of memory when you have all 5 pages filled or does it 
take
some time before you get the exception ?

There is no need to call System.gc(), but do try to increase memory as
suggested and see if that helps.

Mikael

----- Original Message ----- 
From: "Tonny Kohar" <to...@gmail.com>
To: <ba...@xmlgraphics.apache.org>
Sent: Thursday, February 14, 2008 6:18 AM
Subject: Re: Outofmemory using Batik libs


> Hi,
>
> On Feb 14, 2008 10:25 AM, Henrique de Miranda Gontijo
> <hg...@nextech.com.br> wrote:
>>
>> I need some help with the problem of out of memory with at jsvgcanvas. At 
>> my
>> viewer, I have a ArrayList() where I put my JSVGCanvas objects. The size 
>> of
>> the ArrayList is the total of pages the document have.
>> I want to keep five pages in memory. So every time I change this cache, I 
>> do
>> this:
>>
>> /* This for can found the correct pages in memory */
>> for (int i = currentRange.getStartPage(); i < currentRange.getEndPage() + 
>> 1;
>> i++) {
>> FVCanvas canvas = (FVCanvas) iterator.getItemAtPosition(i);
>> canvas.stopProcessing();
>> canvas.setDocument(null);
>> canvas.dispose();
>> }
>>
>> I also call System.gc() every time I change the page.
>> Does anybody have any idea why some memory still in use?
>>
>>
>
> I do not know about why some memory still in use. But you can increase
> the memory of your java application by adding -Xmx???m eg: -Xmx256m.
>
> I think the amount of memory used by Batik is less influenced by
> number of pages, but more toward how big and how many element, how
> complex element is the page (the bigger/complex the more memory used,
> although it is only 1 page)
>
> I think batik memory can be divided into:
> - DOM object
> - Renderer result (this is image file)
> - Renderer cache result (this is image file)
> - other things.
>
> it is all added together. Just the renderer result already quite big
> if you have big image resolution (basic calc eg: 1024*768*4(RGBA) +
> other things)
>
> I think Batik maintainer will know better how batik use memory.
>
> Cheers
> Tonny Kohar
> -- 
> Sketsa SVG Editor
> imagine, design, create ...
> http://www.kiyut.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Outofmemory using Batik libs

Posted by Tonny Kohar <to...@gmail.com>.
Hi,

On Feb 14, 2008 10:25 AM, Henrique de Miranda Gontijo
<hg...@nextech.com.br> wrote:
>
> I need some help with the problem of out of memory with at jsvgcanvas. At my
> viewer, I have a ArrayList() where I put my JSVGCanvas objects. The size of
> the ArrayList is the total of pages the document have.
> I want to keep five pages in memory. So every time I change this cache, I do
> this:
>
> /* This for can found the correct pages in memory */
> for (int i = currentRange.getStartPage(); i < currentRange.getEndPage() + 1;
> i++) {
> FVCanvas canvas = (FVCanvas) iterator.getItemAtPosition(i);
> canvas.stopProcessing();
> canvas.setDocument(null);
> canvas.dispose();
> }
>
> I also call System.gc() every time I change the page.
> Does anybody have any idea why some memory still in use?
>
>

I do not know about why some memory still in use. But you can increase
the memory of your java application by adding -Xmx???m eg: -Xmx256m.

I think the amount of memory used by Batik is less influenced by
number of pages, but more toward how big and how many element, how
complex element is the page (the bigger/complex the more memory used,
although it is only 1 page)

I think batik memory can be divided into:
- DOM object
- Renderer result (this is image file)
- Renderer cache result (this is image file)
- other things.

it is all added together. Just the renderer result already quite big
if you have big image resolution (basic calc eg: 1024*768*4(RGBA) +
other things)

I think Batik maintainer will know better how batik use memory.

Cheers
Tonny Kohar
-- 
Sketsa SVG Editor
imagine, design, create ...
http://www.kiyut.com

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org