out of memory java heap space

2,041 views
Skip to first unread message

ytbryan

unread,
Jun 17, 2009, 5:46:55 AM6/17/09
to gwt-maven
Hi all,

i got the error : java heap space when doing mvn gwt:compile

i changed the following but didnt' help.

<configuration>
[...]
<extraJvmArgs>-Xmx1024m</
extraJvmArgs>
</configuration>



can someone advise me what to do?

twittwit

unread,
Jun 17, 2009, 6:00:22 AM6/17/09
to gwt-maven
i also tried changing it to <extraJvmArgs>-Xmx256m -Xms256m</
extraJvmArgs> but same java heap space error occur.

Brian Cribbs

unread,
Jun 17, 2009, 7:34:38 AM6/17/09
to gwt-...@googlegroups.com
Are you by chance using the 64-bit JDK?

twittwit

unread,
Jun 17, 2009, 7:53:47 AM6/17/09
to gwt-maven
may i know how do i check that? what happen if i use 64bits jdk?


On Jun 17, 1:34 pm, Brian Cribbs <briancri...@gmail.com> wrote:
> Are you by chance using the 64-bit JDK?
>

twittwit

unread,
Jun 17, 2009, 7:55:34 AM6/17/09
to gwt-maven
may i know how do i check that? what happen if i use 64bits jdk?


On Jun 17, 1:34 pm, Brian Cribbs <briancri...@gmail.com> wrote:
> Are you by chance using the 64-bit JDK?
>

twittwit

unread,
Jun 17, 2009, 8:05:46 AM6/17/09
to gwt-maven
may i know how do i check that? what happen if i use 64bits jdk?


On Jun 17, 1:34 pm, Brian Cribbs <briancri...@gmail.com> wrote:
> Are you by chance using the 64-bit JDK?
>

Brian Cribbs

unread,
Jun 17, 2009, 8:23:04 AM6/17/09
to gwt-...@googlegroups.com
Not sure, should be in the java path somewhere.  We had a dev that was using the 64-bit JDK and was running into issues compiling GWT apps.

bak1an

unread,
Jun 17, 2009, 7:11:28 AM6/17/09
to gwt-maven
try something like that:

$ MAVEN_OPTS="-Xmx512m" mvn whatever_you_want

twittwit

unread,
Jun 17, 2009, 9:09:51 AM6/17/09
to gwt-maven
where do i insert that?

i was doing mvn gwt:compile

twittwit

unread,
Jun 17, 2009, 9:10:10 AM6/17/09
to gwt-maven
where do i insert that?

i was doing mvn gwt:compile

On Jun 17, 1:11 pm, bak1an <antonbakla...@gmail.com> wrote:

mars1412

unread,
Jun 17, 2009, 10:29:18 AM6/17/09
to gwt-maven
MAVEN_OPTS=-Xmx512m
is an environment variable, that you set in the command line

twittwit

unread,
Jun 17, 2009, 12:10:23 PM6/17/09
to gwt-maven
sorry. I search around but still donno where i should put MAVEN_OPTS=-
Xmx512m.

i tried looking into mvn.bat but there seems to be no default
MAVEN_OPTS so i am not sure where to set MAVEN_OPTS.

can someone advise me?


bryan

Farrukh Najmi

unread,
Jun 17, 2009, 12:46:43 PM6/17/09
to gwt-...@googlegroups.com
OutOfMemory error should typically be dealt via JAVA_OPTS and JAVA_OPTIONS env vars. Not sure which is correct (I set them both).

You should put it wherever you initialize shell variable. On Linux I use the following in ~/.bashrc for the bash shell.

export JAVA_OPTS="-Xms200m -Xmx1500m -XX:+CMSClassUnloadingEnabled -XX:PermSize=512m -XX:MaxPermSize=512m"
export JAVA_OPTIONS="$JAVA_OPTS"

I do not do windows but here is a resource found by google:

<http://vlaurie.com/computers2/Articles/environment.htm>
--
Regards,
Farrukh

mars1412

unread,
Jun 18, 2009, 4:15:16 AM6/18/09
to gwt-maven
http://maven.apache.org/download.html
search for MAVEN_OPTS

Charlie Collins

unread,
Jun 18, 2009, 7:37:06 AM6/18/09
to gwt-maven
Are you using gwt-maven (maven-googlewebtoolkit2-plugin)?

If so, you are on the correct list, and extraJvmArgs should work just
fine. You might need to make it more than 256 though (depending on
your VM and OS, 256 may already be the default, and the GWT compiler
needs a lot of memory, make it 512 or 1024 or such).

Also, as another poster here stated, MAVEN_OPTS is an environment
variable. Maven opts won't matter to gwt-maven though, it writes a
script and executes outside of the Maven VM (hence the "extraJvmArgs"
and other options).

mars1412

unread,
Jun 18, 2009, 7:55:12 AM6/18/09
to gwt-maven
I think I had to increase both, the MAVEN_OPTS and the extraJvmArgs,
to get this working.

As I understood it, it's like that:
when you call
>mvn XXX
then the mvn process gets the amount of memory specified in MAVEN_OPTS
from the OS.
let's say: 256MB
then this process will fork a java-process (to do the gwt-
complilation) and this jvm-process tries to allocate the amount of
memory specified in extraJvmArgs.
but I think, that the OS does not allow the forked process to request
more data than the current process's limit (of 256MB)
thus setting extraJvmArgs to a higher level than specified in
MAVEN_OPTS has no effect

please note, that I am absolutely not sure about this and it might
also depend on the OS an settings, etc.

Anyone please correct me if this is wrong.
Reply all
Reply to author
Forward
0 new messages