• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to increase the Java heap memory for Maven 3 on windows7  RSS feed

 
hani se
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends
How to increase the Java heap memory for Maven 3 on windows7?I'm getting this error while building maven project:"java.lang.OutOfMemoryError: PermGen space”
thanks
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
emma smith wrote:How to increase the Java heap memory for Maven 3 on windows7?I'm getting this error while building maven project:"java.lang.OutOfMemoryError: PermGen space”

For Maven? Dunno. It's a parameter to the java command normally.

However, before you start increasing heap space, you might want to ask yourself why. The defaults are usually more than adequate for a normal program, so if you're exceeding it, it might indicate a problem with your code.

Winston
 
hani se
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:For Maven? Dunno. It's a parameter to the java command normally.

However, before you start increasing heap space, you might want to ask yourself why. The defaults are usually more than adequate for a normal program, so if you're exceeding it, it might indicate a problem with your code.

Winston

yes, for maven i'm sure that the code is correct because i want to run apache stanbol launcher, it isn't my code!
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:However, before you start increasing heap space, you might want to ask yourself why. The defaults are usually more than adequate for a normal program, so if you're exceeding it, it might indicate a problem with your code.

Maven is well-known for needing oodles of memory, especially for large projects. It's a build-time tool, so what the code actually does makes little difference - there are probably lots of classes, or other build-time complications.

Maven JVM options can be set via the MAVEN_OPTS environment variable. On a Unix-ish system it would be something like "setenv MAVEN_OPTS -Xmx1024m -XX:MaxPermSize=128m".
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Maven is well-known for needing oodles of memory, especially for large projects. It's a build-time tool, so what the code actually does makes little difference - there are probably lots of classes, or other build-time complications.

Oops. My apologies then Emma: listen to Ulf; he knoweth of which he speak.

Winston
 
hani se
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
Maven JVM options can be set via the MAVEN_OPTS environment variable. On a Unix-ish system it would be something like "setenv MAVEN_OPTS -Xmx1024m -XX:MaxPermSize=128m".

Ok Ulf, i have done it but yet i'm getting java.long.outOfMemeryError!
do you have any more suggestion? don't you think i change the version of maven?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Windows the command should be:

set MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m"

Did you try that?
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
emma smith wrote:
yes, for maven i'm sure that the code is correct because i want to run apache stanbol launcher, it isn't my code!

Why it wastes that much RAM, do you run Apache Stanbol launcher within Maven hosted JVM? In this case you better to fork another process with JVM for Stanbol.
 
hani se
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:On Windows the command should be:

set MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m"

Did you try that?

yes i tried it with 128,512,1024...
 
hani se
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
surlac surlacovich wrote:
Why it wastes that much RAM, do you run Apache Stanbol launcher within Maven hosted JVM? In this case you better to fork another process with JVM for Stanbol.

can you explain more Surlac? exactly what should i do?
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
emma smith wrote:can you explain more Surlac? exactly what should i do?

Try to use forkMode (or forkCount).
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any success with that, emma smith?
 
hani se
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
surlac surlacovich wrote:Any success with that, emma smith?

No Surlac i did evrything but i didn't succeed
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you use latest stable version of Maven?
 
hani se
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
surlac surlacovich wrote:Do you use latest stable version of Maven?

yes,i'm really tired!!!
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Connect with profiler and see when the memory consumption grows, dump memory to a file (jmap -permstat <pid>), see which objects wastes permgen space.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!