• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

maven -- java.lang.OutOfMemoryError: Java heap space

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using maven to run my test cases .test cases are mostly related to I/O operation.I am frequently running out of heap space .
how can I set -Xms256m -Xmx1024m for maven?
thanks in advance.
 
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you use the eclipse maven plugin to do maven build ? I used to get the same when i used eclipse maven plugin.... but outside eclipse, it was fine...
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assume you are running from the command line, Maven is run via the mvn (or mvn.bat) script in m2_home/bin. You edit that file, modifying the Java run command. Or you can add a MAVEN_OPTS=xxx line early in that file. Or you could even set the MAVEN_OPTS env var before running maven.
 
Sudhana Madhu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have set env variable before running maven
but that couldn't solve the problem.
below is the stack trace .
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How big is your physical memory? You shouldn't use -Xmx greater or equal to your physical memory.
 
Sudhana Madhu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

my total memory is 2020 mb so I can use 1024m for MAVEN_OPTS=-Xmx1024M
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might try "export MAVEN_OPTS=-Xmx1024m".

Also, set _JAVA_LOADER_DEBUG (you can set it to anything). This will cause the JVM to dump some startup information, including the JVM options it was given. This should help determine if the heap size is being set.
 
Sudhana Madhu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your help
its working after setting MAVEN_OPTS env variable to 1024m
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic