Re: "OutOfMemoryError: Java heap space" when i try to upload and show a hundred 100kb pics

2013-09-01 Thread Michael Mosmann


Am 01.09.13 10:53, schrieb Giovanni:

Martin Grigorov-4 wrote

Hi,
Read about Java memory settings (-Xms, -Xmx)

Yes, I can increase heap space by settings, but is this a good approach? If
displaying one 10Mb pic consumes 1.5Gb heap space - is this normal? Maybe
there are other ways to solve this problem without increasing heap space by
settings?
I think there is a better solution if you do not have unlimited memory 
:). See http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ 
. You generate every image in your page render loop. This way the image 
data is stored in your page (which is bad). If you use a 
DynamichImageResource the image is created when the image request comes 
in. But you have to store your images somewhere else (remove this static 
list of buffered images) and refer to them with an ID.


Michael

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



Re: "OutOfMemoryError: Java heap space" when i try to upload and show a hundred 100kb pics

2013-09-01 Thread Martin Makundi
Try memory profiler to see what is at matter.

**
Martin


2013/9/1 Giovanni 

> Martin Grigorov-4 wrote
> > Hi,
> > Read about Java memory settings (-Xms, -Xmx)
>
> Yes, I can increase heap space by settings, but is this a good approach? If
> displaying one 10Mb pic consumes 1.5Gb heap space - is this normal? Maybe
> there are other ways to solve this problem without increasing heap space by
> settings?
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/OutOfMemoryError-Java-heap-space-when-i-try-to-upload-and-show-a-hundred-100kb-pics-tp4661159p4661161.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: "OutOfMemoryError: Java heap space" when i try to upload and show a hundred 100kb pics

2013-09-01 Thread Giovanni
Martin Grigorov-4 wrote
> Hi,
> Read about Java memory settings (-Xms, -Xmx)

Yes, I can increase heap space by settings, but is this a good approach? If
displaying one 10Mb pic consumes 1.5Gb heap space - is this normal? Maybe
there are other ways to solve this problem without increasing heap space by
settings?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OutOfMemoryError-Java-heap-space-when-i-try-to-upload-and-show-a-hundred-100kb-pics-tp4661159p4661161.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: "OutOfMemoryError: Java heap space" when i try to upload and show a hundred 100kb pics

2013-08-31 Thread Martin Grigorov
Hi,

On Sat, Aug 31, 2013 at 7:27 PM, Giovanni  wrote:

> Hi!
> I need to display more than a hundred pictures on the page (about 100kb -
> 300kb), i but I got the error about heap. I read that the reason of this
> error could be serialization of the page, but I don't know, how to solve
> this.
>

Read about Java memory settings (-Xms, -Xmx)


>
> TestMultipleImages.html:
> /
> http://wicket.apache.org";>
> 
> 
> 
>
> 
> 
> SUMBIT
> 
>
>
>
>
> 
> /
>
> TestMultipleImages.java:
> /public class TestMultipleImages extends WebPage {
> private FileUploadField uploadField;
> private Form form;
>
> private static List images = new
> ArrayList();
>
> @Override
> protected void onBeforeRender() {
> removeAll();
>
> RepeatingView imageRepeater = new
> RepeatingView("imageRepeater");
> add(imageRepeater);
> for (BufferedImage image : images) {
> WebMarkupContainer container = new
> WebMarkupContainer(imageRepeater.newChildId());
> imageRepeater.add(container);
>
> BufferedDynamicImageResource resource = new
> BufferedDynamicImageResource();
> resource.setImage(image);
>
> container.add(new Image("image", resource));
> }
>
> form = new Form("form") {
> @Override
> protected void onSubmit() {
> for (FileUpload fileUpload :
> uploadField.getModelObject()) {
> byte[] bytes =
> fileUpload.getBytes();
>
> ByteArrayInputStream bais = new
> ByteArrayInputStream(bytes);
> BufferedImage readedImage = null;
> try {
> readedImage =
> ImageIO.read(bais);
> bais.close();
> } catch (IOException e) {
> e.printStackTrace();
> }
> images.add(readedImage);
> }
>
> super.onSubmit();
> }
> };
>
> uploadField = new FileUploadField("uploadField");
>         uploadField.setModel(new ListModel());
> form.add(uploadField);
> add(form);
>
> super.onBeforeRender();
> }
> }/
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/OutOfMemoryError-Java-heap-space-when-i-try-to-upload-and-show-a-hundred-100kb-pics-tp4661159.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


"OutOfMemoryError: Java heap space" when i try to upload and show a hundred 100kb pics

2013-08-31 Thread Giovanni
Hi!
I need to display more than a hundred pictures on the page (about 100kb -
300kb), i but I got the error about heap. I read that the reason of this
error could be serialization of the page, but I don't know, how to solve
this.

TestMultipleImages.html:
/
http://wicket.apache.org";>






SUMBIT


  



/

TestMultipleImages.java:
/public class TestMultipleImages extends WebPage {
private FileUploadField uploadField;
private Form form;

private static List images = new 
ArrayList();

@Override
protected void onBeforeRender() {
removeAll();

RepeatingView imageRepeater = new 
RepeatingView("imageRepeater");
add(imageRepeater);
for (BufferedImage image : images) {
WebMarkupContainer container = new
WebMarkupContainer(imageRepeater.newChildId());
imageRepeater.add(container);

BufferedDynamicImageResource resource = new
BufferedDynamicImageResource();
resource.setImage(image);

container.add(new Image("image", resource));
}

form = new Form("form") {
@Override
protected void onSubmit() {
for (FileUpload fileUpload : 
uploadField.getModelObject()) {
byte[] bytes = fileUpload.getBytes();

ByteArrayInputStream bais = new 
ByteArrayInputStream(bytes);
BufferedImage readedImage = null;
try {
readedImage = 
ImageIO.read(bais);
bais.close();
} catch (IOException e) {
e.printStackTrace();
}
images.add(readedImage);
}

super.onSubmit();
}
};

uploadField = new FileUploadField("uploadField");
uploadField.setModel(new ListModel());
form.add(uploadField);
add(form);

super.onBeforeRender();
}
}/




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OutOfMemoryError-Java-heap-space-when-i-try-to-upload-and-show-a-hundred-100kb-pics-tp4661159.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2008-01-02 Thread Eduardo Ito
Take a look at this:

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


On 12/28/07, Artur W. <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Eduardo Issao Ito
Summa Technologies

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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-30 Thread C.

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-30 Thread Artur W.


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-29 Thread Maurice Marrink
the permgen space param = -XX:MaxPermSize=256m
Just in case.

Maurice

On Dec 29, 2007 3:09 PM, Artur W. <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-29 Thread Artur W.


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-29 Thread Johan Compagner
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 <[EMAIL PROTECTED]> 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. <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-28 Thread Eelco Hillenius
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-28 Thread Sebastiaan van Erk

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. <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



smime.p7s
Description: S/MIME Cryptographic Signature


Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-28 Thread Johan Compagner
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. <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-28 Thread Artur W.


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-28 Thread Uwe Schäfer

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-28 Thread Artur W.


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-28 Thread Maurice Marrink
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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-28 Thread Uwe Schäfer

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



OutOfMemoryError: Java heap space - AppendingStringBuffer

2007-12-28 Thread Artur W.

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space

2007-12-05 Thread Igor Vaynberg
> The ListView implementation had
> two Label objects that contained two PropertyModels. I didn't know that
> PropertyModel stores the object, i thought that it only  only stores the
> value of the field. This object is very heavy, and the pages was storing two
> heavy objects for each ListItem instance.

the way to do this is to chain propertymodel with another model, eg

imodel m=new loadabledetachablemodel() {...}
add(new label("a", new propertymodel(m, "a")));
add(new label("b", new propertymodel(m, "b")));

-igor



> Thanks for your help!
>
> --
> View this message in context: 
> http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space-tf4950580.html#a14177708
>
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space

2007-12-05 Thread Sergio García



igor.vaynberg wrote:
> 
> erm, if all your OfferListModel do is have something in load() then
> why do you subclass it instead of the LDM directly?
> 
> -igor
> 
> 


First you have to think that i can't touch the service. The abstract
LoadableDetachableModel retrieves a instance of a TO containing eigth List,
each one containing the Offer objects that have a common state. Each
implementation of OfferListModel retieves a different List from the object
that abstract class loads. I don't mind if it loads eight times the entire
object because i have Hibernate second level cache and it only retrieves one
time from DB the objects. 

While we were talking i found the problem. The ListView implementation had
two Label objects that contained two PropertyModels. I didn't know that
PropertyModel stores the object, i thought that it only  only stores the
value of the field. This object is very heavy, and the pages was storing two
heavy objects for each ListItem instance.

Thanks for your help!

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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space

2007-12-05 Thread Igor Vaynberg
erm, if all your OfferListModel do is have something in load() then
why do you subclass it instead of the LDM directly?

-igor


On Dec 5, 2007 9:57 AM, Sergio García <[EMAIL PROTECTED]> wrote:
>
>
> igor.vaynberg wrote:
> >
> > looks like your page has a reference to some huge object which causes
> > a problem when the page is serialzed - so maybe that loadable
> > detachable model of yours is not very detachable...
> >
> >
> > -igor
> >
>
>
>
> I don't know what i'm doing wrong. I have a abstract detachable model:
>
>
>
> private abstract class OfferListModel extends LoadableDetachableModel{
> @Override
> protected Object load() {
> String stateAsString = stateDropDown.getModelObjectAsString();
> Integer year = (Integer) yearDropDown.getModelObject();
> String userAsString = userDropDown.getModelObjectAsString();
>
> if (StaticComboLists.OFFER_STATE_ALL.equals(stateAsString)) {
> stateAsString = null;
> }
>
> if (StaticComboLists.USER_FILTER_ALL.equals(userAsString)) {
> userAsString = null;
> }else {
> userAsString = getSignInSession().getUser().getLogin();
> }
>
> OffersListParameters parameters =
> new OffersListParameters(userAsString, year, stateAsString);
>
> ClassifiedOffersList offersList =
> offersService.findOffers(parameters);
>
> return offersList;
> }
> }
>
> And eight implementations of it, like this one:
>
> private class BeingPreparedOfferListModel extends OfferListModel{
> private static final long serialVersionUID = -1772413039827980131L;
>
> @Override
> protected Object load() {
> ClassifiedOffersList offersList = (ClassifiedOffersList)
> super.load();
> return offersList.getBeingPrepared();
> }
> }
>
>
> Each instance is used like this:
>
> BeingPreparedOfferListModel beingPreparedOfferListModel =
> new BeingPreparedOfferListModel();
>
> beingPreparedContainer =
> new DisabledIfEmptyMarkupContainer("beingPreparedContainer",
> beingPreparedOfferListModel);
> beingPreparedContainer.add(new
> beingPreparedOfferListView("beingPreparedListView",beingPreparedOfferListModel));
>
> Where the ListView has a reference to a detachable model, and
> DisabledIfEmptyMarkupContainer has a reference also to the DetachableModel:
>
> public class DisabledIfEmptyMarkupContainer extends WebMarkupContainer{
>
> private static final long serialVersionUID = 8749215642567364820L;
> private LoadableDetachableModel model;
>
>
> public DisabledIfEmptyMarkupContainer(String id, LoadableDetachableModel
> model) {
> super(id);
> this.model = model;
> setOutputMarkupPlaceholderTag(true);
> }
>
>
> @SuppressWarnings("unchecked")
> @Override
> protected void onBeforeRender() {
> super.onBeforeRender();
> if (((Collection) model.getObject()).isEmpty()) {
> add(new VisibilityFalseAttributeModifier());
> }else {
> add(new VisibilityTrueAttributeModifier("block"));
> }
> model.detach();
>
> }
>
>
> }
>
>
> Is something wrong that i can't see?
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space-tf4950580.html#a14177105
>
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space

2007-12-05 Thread Sergio García


igor.vaynberg wrote:
> 
> looks like your page has a reference to some huge object which causes
> a problem when the page is serialzed - so maybe that loadable
> detachable model of yours is not very detachable...
> 
> 
> -igor
> 



I don't know what i'm doing wrong. I have a abstract detachable model:



private abstract class OfferListModel extends LoadableDetachableModel{
@Override
protected Object load() {
String stateAsString = stateDropDown.getModelObjectAsString();
Integer year = (Integer) yearDropDown.getModelObject();
String userAsString = userDropDown.getModelObjectAsString();

if (StaticComboLists.OFFER_STATE_ALL.equals(stateAsString)) {
stateAsString = null;
}

if (StaticComboLists.USER_FILTER_ALL.equals(userAsString)) {
userAsString = null;
}else {
userAsString = getSignInSession().getUser().getLogin();
}

OffersListParameters parameters = 
new OffersListParameters(userAsString, year, stateAsString);

ClassifiedOffersList offersList =
offersService.findOffers(parameters); 

return offersList;
}
}

And eight implementations of it, like this one:

private class BeingPreparedOfferListModel extends OfferListModel{
private static final long serialVersionUID = -1772413039827980131L;

@Override
protected Object load() {
ClassifiedOffersList offersList = (ClassifiedOffersList)
super.load();
return offersList.getBeingPrepared();
}
}


Each instance is used like this:

BeingPreparedOfferListModel beingPreparedOfferListModel = 
new BeingPreparedOfferListModel();

beingPreparedContainer = 
new DisabledIfEmptyMarkupContainer("beingPreparedContainer",
beingPreparedOfferListModel);
beingPreparedContainer.add(new
beingPreparedOfferListView("beingPreparedListView",beingPreparedOfferListModel));

Where the ListView has a reference to a detachable model, and
DisabledIfEmptyMarkupContainer has a reference also to the DetachableModel:

public class DisabledIfEmptyMarkupContainer extends WebMarkupContainer{

private static final long serialVersionUID = 8749215642567364820L;
private LoadableDetachableModel model;


public DisabledIfEmptyMarkupContainer(String id, LoadableDetachableModel
model) {
super(id);
this.model = model;
setOutputMarkupPlaceholderTag(true);
} 


@SuppressWarnings("unchecked")
@Override
protected void onBeforeRender() {
super.onBeforeRender();
if (((Collection) model.getObject()).isEmpty()) {
add(new VisibilityFalseAttributeModifier());
}else {
add(new VisibilityTrueAttributeModifier("block"));
}
model.detach();

}


}


Is something wrong that i can't see?



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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError: Java heap space

2007-12-05 Thread Igor Vaynberg
looks like your page has a reference to some huge object which causes
a problem when the page is serialzed - so maybe that loadable
detachable model of yours is not very detachable...


-igor


On Dec 5, 2007 8:00 AM, Sergio García <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a memory problem on my wicket app. It's being developed, so there is
> no reason for a memory problem. The class that throws this exception has a
> intensive use of LoadableDetachableModel.
>
>
> 2007-12-05 16:56:12,032 ERROR [[WicketApplication]]
> (StandardWrapperValve.java:253) - Servlet.service() para servlet
> WicketApplication lanzó excepción
> java.lang.OutOfMemoryError: Java heap space
> at java.util.Arrays.copyOf(Unknown Source)
> at java.io.ByteArrayOutputStream.write(Unknown Source)
> at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown 
> Source)
> at
> java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(Unknown
> Source)
> at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> at java.io.ObjectOutputStream.writeObject(Unknown Source)
> at
> org.apache.wicket.util.io.IObjectStreamFactory$1.writeObjectOverride(IObjectStreamFactory.java:65)
> at java.io.ObjectOutputStream.writeObject(Unknown Source)
> at 
> org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1085)
> at
> org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:198)
> at
> org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:708)
> at
> org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:337)
> at org.apache.wicket.Session.requestDetached(Session.java:1360)
> at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1019)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1266)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343)
> at
> org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:139)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> at
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:183)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
>
>
>
> Reasons?
> --
> View this message in context: 
> http://www.nabble.com/OutOfMemoryError%3A-Java-heap-space-tf4950580.html#a14174603
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



OutOfMemoryError: Java heap space

2007-12-05 Thread Sergio García

Hi,

I have a memory problem on my wicket app. It's being developed, so there is
no reason for a memory problem. The class that throws this exception has a
intensive use of LoadableDetachableModel.


2007-12-05 16:56:12,032 ERROR [[WicketApplication]]
(StandardWrapperValve.java:253) - Servlet.service() para servlet
WicketApplication lanzó excepción
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.io.ByteArrayOutputStream.write(Unknown Source)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown 
Source)
at
java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(Unknown
Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at
org.apache.wicket.util.io.IObjectStreamFactory$1.writeObjectOverride(IObjectStreamFactory.java:65)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at 
org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1085)
at
org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:198)
at
org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:708)
at
org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:337)
at org.apache.wicket.Session.requestDetached(Session.java:1360)
at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1019)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1266)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343)
at
org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:183)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)



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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]