Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of memory during mvn install #115

Closed
mcandre opened this issue Aug 5, 2014 · 7 comments
Closed

Out of memory during mvn install #115

mcandre opened this issue Aug 5, 2014 · 7 comments

Comments

@mcandre
Copy link

mcandre commented Aug 5, 2014

I'm trying to follow the directions for installing scalastyle from source, but I'm getting an out of memory error.

Trace

$ mvn install
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Scalastyle style checker for Scala 0.6.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ scalastyle_2.10 ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ scalastyle_2.10 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO] Copying 0 resource
[INFO] 
[INFO] --- scala-maven-plugin:3.1.0:add-source (scala-compile-first) @ scalastyle_2.10 ---
[INFO] Add Source directory: /Users/andrew/Desktop/src/scalastyle/src/main/scala
[INFO] Add Test Source directory: /Users/andrew/Desktop/src/scalastyle/src/test/scala
[INFO] 
[INFO] --- scala-maven-plugin:3.1.0:compile (scala-compile-first) @ scalastyle_2.10 ---
[WARNING]  Expected all dependencies to require Scala version: 2.10.4
[WARNING]  org.scalariform:scalariform_2.10:0.1.4 requires scala version: 2.10.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] Using incremental compilation
[INFO] Compiling 51 Scala sources to /Users/andrew/Desktop/src/scalastyle/target/classes...
[WARNING] there were 5 deprecation warning(s); re-run with -deprecation for details
[WARNING] there were 4 feature warning(s); re-run with -feature for details
[WARNING] two warnings found
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ scalastyle_2.10 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ scalastyle_2.10 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- scala-maven-plugin:3.1.0:testCompile (scala-test-compile) @ scalastyle_2.10 ---
[WARNING]  Expected all dependencies to require Scala version: 2.10.4
[WARNING]  org.scalariform:scalariform_2.10:0.1.4 requires scala version: 2.10.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] Using incremental compilation
[INFO] Compiling 60 Scala sources to /Users/andrew/Desktop/src/scalastyle/target/test-classes...
[WARNING] Class org.slf4j.Logger not found - continuing with a stub.
[ERROR] PermGen space -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError

Am I doing something wrong?

System

$ specs scala java os
Specs:

specs 0.8
https://github.com/mcandre/specs#readme

sbt sbt-version
[info] Loading project definition from /Users/andrew/Desktop/src/scalastyle/project
Missing bintray credentials /Users/andrew/.bintray/.credentials. Some bintray features depend on this.
[info] Set current project to scalastyle (in build file:/Users/andrew/Desktop/src/scalastyle/)
[info] 0.13.2

scalac -version
Scala compiler version 2.11.1 -- Copyright 2002-2013, LAMP/EPFL

mvn --version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 10:22:22-0500)
Maven home: /usr/local/Cellar/maven/3.1.1/libexec
Java version: 1.7.0_40, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.4", arch: "x86_64", family: "mac"

echo $CLASSPATH


echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home

javac -version
javac 1.7.0_40

java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

system_profiler SPSoftwareDataType | grep 'System Version'
      System Version: OS X 10.9.4 (13E28)
@splunk-brallen
Copy link

Have you tried increasing your perm size? Something like export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"
Could try doubling those sizes as well.

@mcandre
Copy link
Author

mcandre commented Aug 6, 2014

Yes, export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" helps to mitigate this issue.

Could we keep this option in a .jvmopts file to improve the out-of-the-box compile experience.

@matthewfarwell
Copy link
Member

I could add something into the compilation instructions to help if you want?

@mcandre
Copy link
Author

mcandre commented Aug 13, 2014

No. If scalastyle requires more than the default JVM permsize, then the build should be configured accordingly. Don't make users do even more extra steps to make scalastyle.

@matthewfarwell
Copy link
Member

There is a fork option for the scala compiler so I could add the options to the pom. However, I don't know the correct options for your system. You may have more/less memory than me. By default, the JVM allocates you an amount of memory based on a number of things - amount of memory, the operating system, the mode that you are running in - it is different for client and server.

Note that you can't necessarily predict that your build will fail with a permgen error either. I have this problem sometimes. Most of the time (for me at least), when I get an error like this, just rerunning the command works. This is because maven is compiling internal classes which it then uses to compile the sources.

I'd have to add a value of memory option which would work in all cases, and there are simply too many variables. I can recommend a value, but I'm not going to force one on you.

Note that you can put the export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" into your .bashrc and then you don't have to worry about it again.

@matthewfarwell
Copy link
Member

Is this still a problem for you?

@matthewfarwell
Copy link
Member

Closing this. If this is still a problem for you, please either reopen this issue or create a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants