While trying to run my relatively small app, I am constantly getting the out of heap space memory error. I'm running eclipse on Gentoo with 8GB of ram.
Here is my eclipse.ini changes:
--launcher.XXMaxPermSize
1024m
-XX:MaxPermSize=2048m
-Xms512m
-Xmx8192m
And my Ant external tools custom JRE parameters:
-Xms512m
-Xmx8192m
What else can I do? I am constantly receiving in the eclipse log:
!ENTRY com.android.ide.eclipse.adt 4 0 2013-11-28 18:54:55.503
!MESSAGE Unable to execute dex: Java heap space
!STACK 0
java.lang.OutOfMemoryError: Java heap space
at java.util.BitSet.initWords(BitSet.java:164)
at java.util.BitSet.<init>(BitSet.java:159)
at com.android.dx.ssa.SsaMethod.bitSetFromLabelList(SsaMethod.java:137)
...
Is 8 GB your max available RAM?
If that's the case, did you try to reduce Xmx? As discussed here, there is a reason for that boundary. Setting it to your max RAM would not be the intention behind it and may cause system degradation and other weired things. Try setting Xmx to something like 2048. If you get OOMs, slowly go up with that boundary. Even with huge models I never had to assign 8GB, yet.
If that doesn't help, could you add the code of the place that causes the OOM?
Not sure as to why, but I've solved it by removing the Google API libraries that were included. I also removed the android-support-v4 library and now my apps compile fine. In my build path I now only have the android libs.
Related
I had a project that was developed using play scala 2.0 and it was working fine and i had a need to upgrade the version to 2.3.8 . So i migrated my application version by following this link https://www.playframework.com/documentation/2.3.x/Migration23
and i am able to run the code in newer version in my machine where i have 8 GB RAM and jdk 1.7.0_25 but when i run the code from some other machines with 4 GB RAM it throws the following error
Even it is breaking in some systems with 8 GB and jdk 1.8 i am getting confused whether the issue is due to jdk or memory or an issue in play 2.3.8
Can somebody help me in getting this issue resolved
Attached link to my complete stacktrace
Thanks in advance
Since it's a stackoverflow exception, bumping up the stack size did the trick for me:
export SBT_OPTS=-Xss4m
You can try adjusting the number to see what works. I'm still not clear on the root cause as it repros on both Java 7 and Java 8, and have seen the error pop up at compile time as well.
Encountered the same problem after searching for long on this issue.
Try starting your application with this command
"activator clean -Xms1g -Xmx2g run"
if it doesn't work try increasing 1g and 2g to 2g and 3g resp.
Edit:
If, you want to avoid specifying parameters every time you run the application. you can add this into build.sbt file as follows:
javaOptions ++= Seq(-Xms1G, "-Xmx2G")
I'm trying to use sbt on an amazon ec2 micro instance but I'm getting this error when I execute sbt command.
mkdir prueba
cd prueba
sbt
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (malloc) failed to allocate 715849728 bytes for committing reserved memory
Any ideas?
Thank you in advance!
You have to run sbt with a switch limitting the used memory to be less than the available on machine.
Instead of editing files, I run sbt with sbt -mem 256 for example to get -Xmx and -Xms to 256MB. Works fine.
I used to run sbt on EC2 micro. Previously SBT could be used with 256M heap or possibly even smaller. Try running something like this
export SBT_OPTS="-Xms128M -Xmx256M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jardirname $0/sbt-launch.jar "$#"
I seem to get this error every time I open up eclipse. I'm using the Juno version with the typical Java developer set up. Any ideas? Thanks!
An internal error occurred during: "JSP Index Manager: Processing Resource Events". java.lang.NullPointerException
Unfortunately, it seems like a bug, still occurring in Juno SR2.
I just got this on Kepler (installed yesterday, and it is not SR1). Since my message said:
An internal error occurred during: "JSP Index Manager: Processing Resource Events".
Java heap space
I did the obvious - opened the eclipse.ini file and increased the default vmargs values to the following:
-vmargs
-Xms512m
-Xmx1536m
These values worked for me and since then the message haven't appeared.
-Xms512m
-Xmx512m
worked for me, I am using eclipse kepler. Please adjust as per your requirement
-Xms512m -Xmx512m or -Xms512m -Xmx1024m will work depends upon of your configuration.
I am getting the following error when building a project in eclipse indigo:
An internal error occurred during: "Compacting resource model". Java heap.
Is this a memory problem?
Is it possible to compile a single package in eclipse (like similar to netbeans)? I had got a similar memory problem in netbeans but I got around it by compiling smaller number of packages at a time.
I had compiled the same project in ganemede without any problem.
UPDATE:
Stacktrace:
!ENTRY org.eclipse.core.jobs 4 2 2012-03-07 09:39:49.520
!MESSAGE An internal error occurred during: "Compacting resource model".
!STACK 0
java.lang.OutOfMemoryError: Java heap space
at java.util.HashMap.newKeyIterator(Unknown Source)
at java.util.HashMap$KeySet.iterator(Unknown Source)
at java.util.HashSet.iterator(Unknown Source)
at org.eclipse.core.internal.jobs.JobManager.findBlockingJob(JobManager.java:685)
at org.eclipse.core.internal.jobs.JobManager.doRunNow(JobManager.java:1085)
at org.eclipse.core.internal.jobs.JobManager.runNow(JobManager.java:1080)
at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:89)
at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:286)
at org.eclipse.core.internal.utils.StringPoolJob.run(StringPoolJob.java:101)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
!ENTRY org.eclipse.core.jobs 4 2 2012-03-07 09:39:49.521
!MESSAGE An internal error occurred during: "Build Project".
!STACK 0
java.lang.OutOfMemoryError: Java heap space
at org.eclipse.wst.jsdt.core.compiler.CharOperation.concat(CharOperation.java:689)
at org.eclipse.wst.jsdt.core.infer.InferEngine.createAnonymousTypeName(InferEngine.java:682)
at org.eclipse.wst.jsdt.core.infer.InferEngine.createAnonymousType(InferEngine.java:658)
at org.eclipse.wst.jsdt.core.infer.InferEngine.visit(InferEngine.java:2072)
at org.eclipse.wst.jsdt.internal.compiler.DelegateASTVisitor.visit(DelegateASTVisitor.java:855)
at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteral.traverse(ObjectLiteral.java:66)
at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:459)
at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:174)
at org.eclipse.wst.jsdt.internal.compiler.ast.FunctionExpression.traverse(FunctionExpression.java:48)
at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteralField.traverse(ObjectLiteralField.java:63)
at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteral.traverse(ObjectLiteral.java:69)
at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteralField.traverse(ObjectLiteralField.java:63)
at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteral.traverse(ObjectLiteral.java:69)
at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:459)
at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:174)
at org.eclipse.wst.jsdt.internal.compiler.ast.FunctionExpression.traverse(FunctionExpression.java:48)
at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:455)
at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:584)
at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:539)
at org.eclipse.wst.jsdt.core.infer.InferEngine.doInfer(InferEngine.java:1747)
at org.eclipse.wst.jsdt.internal.compiler.parser.Parser.inferTypes(Parser.java:7093)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:561)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.beginToCompile(Compiler.java:328)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.compile(Compiler.java:342)
at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:288)
at org.eclipse.wst.jsdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:86)
at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:254)
at org.eclipse.wst.jsdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:58)
at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:291)
at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:194)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
Open eclipse configuration(eclipse.ini) file folder from eclipse directory
-vmargs
-Xms128m
-Xmx512m
-XX:MaxPermSize=128m
place this code ...its work for me
You need more heap (RAM).
-Xmx in the eclipse.ini file (for me on Linux Ubuntu it is here: "/home/my_username/eclipse/cpp-2019-12/eclipse/eclipse.ini") specifies the maximum heap space (RAM) you are authorizing Eclipse to use. Give it more. If -Xmx512m (512 MB) of RAM isn't enough, try more: -Xmx1024m, or -Xmx2048m, etc, until it is enough and you quit getting crashes.
I talk about this in my Eclipse document here:
readme with links to it in PDF or Google Drive form: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/tree/master/eclipse
Eclipse is powerful, but it is a terrible terrible terrible memory hog. On some machines for some repos I set it to -Xmx32768 (32 GB--yeah--nuts--but try letting Eclipse index a massive repo with the Boost library included and this still isn't enough).
I increased -Xmx by 1GB, from 3 to 4 (-Xmx4120m) and I still have Eclipse doing some laundry (4,5 GB it took from my operating system), but at least I'm able to work (edit and save files). Previously, with 3GB, I couldn't - Eclipse went white.
Plus - I closed 3 projects I wasn't using.
I have noticed a strange behavior of my scala compiler. It occasionally throws an OutOfMemoryError when compiling a class. Here's the error message:
[info] Compiling 1 Scala source to /Users/gruetter/Workspaces/scala/helloscala/target/scala-2.9.0/test-classes...
java.lang.OutOfMemoryError: PermGen space
Error during sbt execution: java.lang.OutOfMemoryError: PermGen space
It only happens once in a while and the error is usually not thrown on the subsequent compile run. I use Scala 2.9.0 and compile via SBT.
Does anybody have a clue as to what might be the cause for this error? Thanks in advance for your insights.
I use HomeBrew to install sbt on OS X. It supports a SBT_OPTS argument which can be put in ~/.sbtconfig file with export SBT_OPTS=-XX:MaxPermSize=256M.
The cause for OutOfMemoryError: PermGen space is that it doesn't have enough permanent generation space :) If you are using Oracle JVM, you need to add the -XX:MaxPermSize=256M (or some other amount of space) argument to your sbt script. For other JVMs, look at their documentation.
I assumed you're using sbt 0.13.6 or higher. Create .sbtopts file in your sbt project's root with the following content:
-J-Xmx4G
-J-XX:MaxMetaspaceSize=1G
-J-XX:MaxPermSize=1G
-J-XX:+CMSClassUnloadingEnabled
MaxMetaspaceSize is for Java 8 whereas MaxPermSize is for Java 7. They are critical to prevent out of memory errors related either to permgen or metaspace exhaustion. Of course, consider adapting flag values or adding any other flags required.
More details and alternative approaches can be found in this blog post.
I had this issue, played around with it for 10 minutes looking at sites trying to change the memory size.
Turns out i resolved it by,
user-profile$ sbt
Then,
sbt-project-name 0.1> clean
This cleared it up for me.
It looks like a memory leak in SBT for me as in my case the program compiles and runs successfully for about 3-5 times before hitting the exception which is fixed by SBT restart.
The most adequate solution indeed seems to be -XX:MaxPermSize= JVM parameter as Alexey Romanov suggests or to restart SBT periodically if it helps.
But there is another interesting way: try switching to Java 8. AFAIK it doesn't use PermGen any more and is probably immune to this exception this way.
I still hope SBT authors will address this issue in future versions.
I am building with the Jenkins sbt plugin and had the same problems. They were resolved after copying the SBT_OPTS from the sbt file to the Jenkins job config's JVM flags.
Originally using a command like:
java -jar /path/to/sbt-launch.jar test
I got first OutOfMemoryError: PermGen space which I solved using -XX:MaxPermSize, and then OutOfMemoryError: Java heap space, to which -Xmx was the remedy.
So in my case, a command like this worked:
java -XX:MaxPermSize=256M -Xmx2048M -jar /path/to/sbt-launch.jar test
change following code block in sbt.sh file and save its working fine.
get_mem_opts () {
local mem=${1:-1536}
local perm=$(( $mem / 4 ))
(( $perm > 256 )) || perm=1024 //256 to 1024
(( $perm < 1024 )) || perm=2048 // 1024 to 2048
local codecache=$(( $perm / 2 ))
echo "-Xms${mem}m -Xmx${mem}m -XX:MaxPermSize=${perm}m -XX:ReservedCodeCacheSize=${codecache}m"
}
or
using terminal to export sbt config
export SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:PermSize=1024M -XX:MaxPermSize=2048M"
You can also add a .jvmopts file in the root folder of your project, and write inside the file the following:
-Xms1g
-Xmx4g