Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT Modlue Restarts cause Out of Memory Error

I'm developing a GWT application, and I'm having issues with testing in development mode in eclipse.

When I make changes to the client-side code, I refresh the browser page (F5) to reload the module. Every time I do this (whether the code has changed or not), the Development Tab in eclipse shows a new bullet point with "Module xxxx has loaded". As well, according to Task Manager, every time I do this, the javaw.exe host process increases by about 1MB of memory. Eventually (10-20 refreshes later), the page fails to load and the Development Mode tab shows this error:

Out of memory; to increase the amount of memory, use the -Xmx flag at startup (java -Xmx128M ...)

I can fix this by stopping and restarting the server (not the little refresh button in the Developer Mode tab, but the red stop button), but it then the module has to be revalidated, which takes a while. It seems that eclipse doesn't realize I've finished with the old module when I reload a new one. I'm observing the same behavior with a brand-new GWT project, so I don't think it's my code. Is anyone aware of a way to remedy this?

EDIT: See both answers below for possible solutions.

like image 732
thomas88wp Avatar asked Jan 14 '23 16:01

thomas88wp


1 Answers

The default settings gwt dev mode use are the minimum , so you hit an out of memory really quickly.

enter image description here

From this you can see that the permgenspace is to low and if you refresh 20 times in a short periode it will go out of memory.

you can start by using following vmargs :

-Xms512m -Xmx512m -XX:MaxPermSize=256M -XX:+UseParallelGC

But as enrybo pointed out if your application grows it requires more memory:

-Xms512m -Xmx1g -XX:MaxPermSize=256M -XX:+UseParallelGC
like image 65
David Avatar answered Jan 24 '23 09:01

David