You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Artur W." <a_...@gazeta.pl> on 2007/12/28 13:06:40 UTC

OutOfMemoryError: Java heap space - AppendingStringBuffer

Hello Everybody!


I just got OutOfMemoryError in our production application (wicket 1.3rc2).
Any ideas what was the reason?


Artur

java.lang.OutOfMemoryError: Java heap space	at
org.apache.wicket.util.string.AppendingStringBuffer.expandCapacity(AppendingStringBuffer.java:158)
at
org.apache.wicket.util.string.AppendingStringBuffer.append(AppendingStringBuffer.java:376)
at
org.apache.wicket.util.string.AppendingStringBuffer.append(AppendingStringBuffer.java:344)
at
org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:113)
at org.apache.wicket.markup.ComponentTag.writeOutput(ComponentTag.java:661)
at org.apache.wicket.Component.renderComponentTag(Component.java:3768)	at
org.apache.wicket.Component.renderComponent(Component.java:2410)	at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1354)	at
org.apache.wicket.Component.render(Component.java:2256)	at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1240)	at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1407)
at
org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:631)
at
org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java:112)
at org.apache.wicket.Component.renderComponent(Component.java:2419)	at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1354)	at
org.apache.wicket.Component.render(Component.java:2256)	at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1240)	at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1407)
at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1344)
at org.apache.wicket.Component.renderComponent(Component.java:2419)	at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1354)	at
org.apache.wicket.Component.render(Component.java:2256)	at
org.apache.wicket.markup.repeater.AbstractRepeater.renderChild(AbstractRepeater.java:119)
at
org.apache.wicket.markup.repeater.AbstractRepeater.onRender(AbstractRepeater.java:100)
at org.apache.wicket.Component.render(Component.java:2256)	at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1240)	at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1407)
at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1344)
at org.apache.wicket.Component.renderComponent(Component.java:2419)	at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1354)	at
org.apache.wicket.Component.render(Component.java:2256)	at
org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:222)
-- 
View this message in context: http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14525029.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by Eduardo Ito <zi...@summa-tech.com>.
Take a look at this:

http://cwiki.apache.org/WICKET/best-practices-and-gotchas.html#BestPracticesandGotchas-AnonymousInnerclasses


On 12/28/07, Artur W. <a_...@gazeta.pl> wrote:
>
> Hello Everybody!
>
>
> I just got OutOfMemoryError in our production application (wicket 1.3rc2).
> Any ideas what was the reason?
>
>
> Artur
>
> java.lang.OutOfMemoryError: Java heap space     at
> org.apache.wicket.util.string.AppendingStringBuffer.expandCapacity(AppendingStringBuffer.java:158)
> at
> org.apache.wicket.util.string.AppendingStringBuffer.append(AppendingStringBuffer.java:376)
> at
> org.apache.wicket.util.string.AppendingStringBuffer.append(AppendingStringBuffer.java:344)
> at
> org.apache.wicket.protocol.http.BufferedWebResponse.write(BufferedWebResponse.java:113)
> at org.apache.wicket.markup.ComponentTag.writeOutput(ComponentTag.java:661)
> at org.apache.wicket.Component.renderComponentTag(Component.java:3768)  at
> org.apache.wicket.Component.renderComponent(Component.java:2410)        at
> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1354)   at
> org.apache.wicket.Component.render(Component.java:2256) at
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1240) at
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1407)
> at
> org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:631)
> at
> org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java:112)
> at org.apache.wicket.Component.renderComponent(Component.java:2419)     at
> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1354)   at
> org.apache.wicket.Component.render(Component.java:2256) at
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1240) at
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1407)
> at
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1344)
> at org.apache.wicket.Component.renderComponent(Component.java:2419)     at
> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1354)   at
> org.apache.wicket.Component.render(Component.java:2256) at
> org.apache.wicket.markup.repeater.AbstractRepeater.renderChild(AbstractRepeater.java:119)
> at
> org.apache.wicket.markup.repeater.AbstractRepeater.onRender(AbstractRepeater.java:100)
> at org.apache.wicket.Component.render(Component.java:2256)      at
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1240) at
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1407)
> at
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1344)
> at org.apache.wicket.Component.renderComponent(Component.java:2419)     at
> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1354)   at
> org.apache.wicket.Component.render(Component.java:2256) at
> org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:222)
> --
> View this message in context: http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14525029.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Eduardo Issao Ito
Summa Technologies

"Discipline is never an end in itself, only a means to an end"

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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by Maurice Marrink <ma...@gmail.com>.
the permgen space param = -XX:MaxPermSize=256m
Just in case.

Maurice

On Dec 29, 2007 3:09 PM, Artur W. <a_...@gazeta.pl> wrote:
>
>
> Eelco Hillenius wrote:
> >
> >
> > Yes, use a profiler. Everyone who is working on a production system
> > should regularly use a profiler and load testing tool to ensure there
> > are no memory leaks etc. In my experience and if you search threads in
> > this list, leaks are often caused by simple mistakes, such as keeping
> > pages references from your session/ application.
> >
>
> I will do that! Thanks for help to everyone!
>
>
> Artur
>
> --
> View this message in context: http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14537843.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by "Artur W." <a_...@gazeta.pl>.

Eelco Hillenius wrote:
> 
> 
> Yes, use a profiler. Everyone who is working on a production system
> should regularly use a profiler and load testing tool to ensure there
> are no memory leaks etc. In my experience and if you search threads in
> this list, leaks are often caused by simple mistakes, such as keeping
> pages references from your session/ application.
> 

I will do that! Thanks for help to everyone!


Artur

-- 
View this message in context: http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14537843.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by Eelco Hillenius <ee...@gmail.com>.
> I start tomcat with:
> -Xms512M -Xmx768M
>
> Should I consider something else?

Yes, use a profiler. Everyone who is working on a production system
should regularly use a profiler and load testing tool to ensure there
are no memory leaks etc. In my experience and if you search threads in
this list, leaks are often caused by simple mistakes, such as keeping
pages references from your session/ application.

Eelco

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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by Johan Compagner <jc...@gmail.com>.
yeah but South Africa has 3G no idea what thats gonna cost me.
But also internet cafes so i should use those more often..

johan

On Dec 29, 2007 12:09 AM, Sebastiaan van Erk <se...@sebster.com> wrote:

> He, I thought you were having vacation!!!! :-PPP
>
> Seb*
>
> Johan Compagner wrote:
> > Nowadays its also many times the perm heap thats to small. Dont know
> > if that is the cause for you because i think it will say that in the
> > exception (the propery for that is a special XX system property dont
> > have that at hand)
> >
> > On 12/28/07, Artur W. <a_...@gazeta.pl> wrote:
> >>
> >> Mr Mean wrote:
> >>> Did you try starting your app container with extra memory, by default
> >>> java does not allocate that much, a common webapp is likely to run out
> >>> of memory with the default settings.
> >>>
> >> I start tomcat with:
> >> -Xms512M -Xmx768M
> >>
> >> Should I consider something else?
> >>
> >>
> >> Runtime.getRuntime().freeMemory() returns 165MB.
> >>
> >>
> >> Thanks in advance.
> >> Artur
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14527774.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>

Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by Sebastiaan van Erk <se...@sebster.com>.
He, I thought you were having vacation!!!! :-PPP

Seb*

Johan Compagner wrote:
> Nowadays its also many times the perm heap thats to small. Dont know
> if that is the cause for you because i think it will say that in the
> exception (the propery for that is a special XX system property dont
> have that at hand)
> 
> On 12/28/07, Artur W. <a_...@gazeta.pl> wrote:
>>
>> Mr Mean wrote:
>>> Did you try starting your app container with extra memory, by default
>>> java does not allocate that much, a common webapp is likely to run out
>>> of memory with the default settings.
>>>
>> I start tomcat with:
>> -Xms512M -Xmx768M
>>
>> Should I consider something else?
>>
>>
>> Runtime.getRuntime().freeMemory() returns 165MB.
>>
>>
>> Thanks in advance.
>> Artur
>>
>> --
>> View this message in context:
>> http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14527774.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by Johan Compagner <jc...@gmail.com>.
Nowadays its also many times the perm heap thats to small. Dont know
if that is the cause for you because i think it will say that in the
exception (the propery for that is a special XX system property dont
have that at hand)

On 12/28/07, Artur W. <a_...@gazeta.pl> wrote:
>
>
> Mr Mean wrote:
> >
> > Did you try starting your app container with extra memory, by default
> > java does not allocate that much, a common webapp is likely to run out
> > of memory with the default settings.
> >
>
> I start tomcat with:
> -Xms512M -Xmx768M
>
> Should I consider something else?
>
>
> Runtime.getRuntime().freeMemory() returns 165MB.
>
>
> Thanks in advance.
> Artur
>
> --
> View this message in context:
> http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14527774.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by "Artur W." <a_...@gazeta.pl>.

Mr Mean wrote:
> 
> Did you try starting your app container with extra memory, by default
> java does not allocate that much, a common webapp is likely to run out
> of memory with the default settings.
> 

I start tomcat with:
-Xms512M -Xmx768M

Should I consider something else?


Runtime.getRuntime().freeMemory() returns 165MB.


Thanks in advance.
Artur

-- 
View this message in context: http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14527774.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by Maurice Marrink <ma...@gmail.com>.
Did you try starting your app container with extra memory, by default
java does not allocate that much, a common webapp is likely to run out
of memory with the default settings.

Maurice

On Dec 28, 2007 1:20 PM, Uwe Schäfer <sc...@thomas-daily.de> wrote:
> Hi Artur,
>
> I suppose it isn´t the AppendingStringBuffer that is causing your problem.
> Did you attach a profiler? http://YourKit.com is just one example of a
> good, easy to setup&run profiler.
>
> > java.lang.OutOfMemoryError: Java heap space   at
> > org.apache.wicket.util.string.AppendingStringBuffer.expandCapacity(AppendingStringBuffer.java:158)
>
> cu uwe
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by Uwe Schäfer <sc...@thomas-daily.de>.
Artur W. schrieb:

> I didn't. It happened in our production server and only once. But this kind
> of errors makes me worry so
> I wanted to ask about it.

i´d suggest you duplicate your productionserver and attach a profiler 
while load-testing with some usual tool like jmeter etc in order to see 
if/where you´re leaking.

cu uwe


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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by "Artur W." <a_...@gazeta.pl>.

Uwe Schäfer wrote:
> 
> I suppose it isn´t the AppendingStringBuffer that is causing your problem.
> Did you attach a profiler? http://YourKit.com is just one example of a 
> good, easy to setup&run profiler.
> 

I didn't. It happened in our production server and only once. But this kind
of errors makes me worry so
I wanted to ask about it.

Artur



-- 
View this message in context: http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14526513.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by "C. Bergström" <cb...@netsyncro.com>.
On Sun, 2007-12-30 at 07:46 -0800, Artur W. wrote:
> 
> Uwe Schäfer wrote:
> > 
> > Hi Artur,
> > 
> > I suppose it isn´t the AppendingStringBuffer that is causing your problem.
> > Did you attach a profiler? http://YourKit.com is just one example of a 
> > good, easy to setup&run profiler.
> > 
> > 
> I did like you said. I turns out that my refreshView consume so much memory
> but it still don't know
> if it is correct for the wicket app or not?
> 
> Ok, so I have a RefreshingView. This repeater contains about 300 rows.
> Every row contains about 20 ajax components (AjaxLinks, AjaxButtons,
> AjaxEditableLabels, ModalsWindows).
> Components have references to each other because clicking on one can change
> state of another (using AjaxRequestTarget).
> 
> With every change, especially when opening ModalWindow, free memory drops
> approx. 20MB.
> (org.apache.wicket.protocol.http.pagestore.DiskPageStore retained size is
> about 27MB just after few clicks).
> 
> When I force gc used memory drops to 50MB which is the same value as the
> application starts.
> So I think this is a prove that I don't hold references to unused objects :)
> 
> So my question is. Am i doing something wrong or it is normal for wicket to
> consume so much
> memory when using so many ajax components on one page?

I'm very interested in what your code looks like.  If it's straight
forward enough can you make a quickstart reproducing this?  I'm doing
some performance profiling of wicket (cpu/memory) and it or may not be a
use case to expose places we can optimize.

Cheers,

./C


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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by "Artur W." <a_...@gazeta.pl>.

Uwe Schäfer wrote:
> 
> Hi Artur,
> 
> I suppose it isn´t the AppendingStringBuffer that is causing your problem.
> Did you attach a profiler? http://YourKit.com is just one example of a 
> good, easy to setup&run profiler.
> 
> 
I did like you said. I turns out that my refreshView consume so much memory
but it still don't know
if it is correct for the wicket app or not?

Ok, so I have a RefreshingView. This repeater contains about 300 rows.
Every row contains about 20 ajax components (AjaxLinks, AjaxButtons,
AjaxEditableLabels, ModalsWindows).
Components have references to each other because clicking on one can change
state of another (using AjaxRequestTarget).

With every change, especially when opening ModalWindow, free memory drops
approx. 20MB.
(org.apache.wicket.protocol.http.pagestore.DiskPageStore retained size is
about 27MB just after few clicks).

When I force gc used memory drops to 50MB which is the same value as the
application starts.
So I think this is a prove that I don't hold references to unused objects :)

So my question is. Am i doing something wrong or it is normal for wicket to
consume so much
memory when using so many ajax components on one page?


Thanks in advance
Artur
-- 
View this message in context: http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space---AppendingStringBuffer-tp14525029p14548202.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

Posted by Uwe Schäfer <sc...@thomas-daily.de>.
Hi Artur,

I suppose it isn´t the AppendingStringBuffer that is causing your problem.
Did you attach a profiler? http://YourKit.com is just one example of a 
good, easy to setup&run profiler.

> java.lang.OutOfMemoryError: Java heap space	at
> org.apache.wicket.util.string.AppendingStringBuffer.expandCapacity(AppendingStringBuffer.java:158)

cu uwe



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