How to get Java to give Alloy more memory - java

I am using alloy4.2, and I am not able to tell it to use more memory.
I am not a Java expert and I suspect the problem is in how I'm configuring Java.
I am using OpenJDK Runtime Environment 1.8.0_131.
I have also tried 1.8.0_151.
My VM is running in Ubuntu x64.
Under the Alloy Options tab, Maximum Memory To Use is always stuck at the default of 768M.
I am using a VM that has 16G of memory available.
I have tried setting the Java stack parameters
-Xms1g and -Xmx8g
at the command line when I invoke Java, and also using the "export _JAVA_OPTS" to no avail.
Java says it is "picking up" the Xms and Xmx values and when I run
Java -XshowSettings:vm it shows that I have a max heap size of approx. 7.9G.
But Alloy doesn't let me increase the memory beyond the tiny minimum size of 768M. Any idea what I am doing wrong?

The numbers are hardcoded in Alloy although 4.2 should have 4Gb included? (There are a number of variants of 4.2 out there I think.)
We're working on creating a 5.0.0 version at the moment but that is not really publishable yet. You can download a snapshot JAR from:
https://oss.sonatype.org/content/repositories/snapshots/org/alloytools/org.alloytools.alloy.dist/5.0.0-SNAPSHOT/

Related

Started seeing object heap exceptions Java 6

I've started seeing the following error using 32-bit (and 64 for that matter) Java 6 (on Windows 8 x64. This wasn't an issue until some Windows updates were installed.....) to call ant scripts
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
Anyone ever seen it before? I've done some digging around SO and other places and haven't come across anything that's solved this issue for
Edit 8/24
So far, here are the following things I have attempted to fix the issue, none of which have worked:
Setting _JAVA_OPTIONS in system environment variables, up to 3gb for the maximum heap size
Setting JVM_OPTS in cmd before invoking ant, again max heap size up to 3gb
Passing in -Xms and -Xmx arguments when making the actual java call, like so %JAVA_HOME%\bin\java -Xms512m -Xmx2048m org.apache.tools.ant.Main
Setting the ANT_OPTS variable before calling ant
Uninstalling Windows updates going back before these issues.
Does anyone have a solution that differs from the following? As the other attempts have not been working..
When you run on 32-bit windows (or in the 32-bit windows emulator) you have only about 1.2 GB - 1.5 GB of virtual memory available. This size depends on what else you might have running in that space as it doesn't always isolate programs from each other in terms of memory space (i.e. the memory space is limit and shared)
So after updating windows, it could have installed a new program which is run before Java, or updated an existing which is using more memory.
The simplest solution is to use a 64-bit JVM which doesn't have this problem. Or you have to reduce the maximum heap size.

Error occured during initialization of VM: Could not reserve enough space for object heap

I am getting below error on starting SonarQube:
Error occured during initialixation of VM: Could not reserve enough space for memory heap
Also modified wrapper.conf underSonarQube conf folder, but didn't work.
Also changed java version: Java 8 to Java 7, didn't work
You do not enough available memory to run SonarQube. Try closing some applications.
If this is not enough check whether SonarQube's startup script specifies the amount of memory required, e.g. with options like -Xms=??? -Xmx=???. These indicate roughly the minimum and maximum amount of memory Java will acquire. Note the actual values and check with the task manager if you have enough memory available.
Issue was with version mismatch of plugins installed in sonarqube. I deleted jars for all plugins except java. This solved the issue.
I figured it out from sonar.log
Thanks
Its due to lack of memory. if you are trying that with ANT try the following
set ANT_OPTS=-XX:MaxPermSize=128m

Easily run out of memory when use Eclipse and Ant/Junit on my Mac

Now that OSX Maverick works with memory different (so it seems and from what I've read), when I run Java as a separate JVM (Ant/JUnit/etc.), I often get OutOfMemory exceptions as it bases the max heap on memory available which is usually close to zero (because that's apparently how Maverick works?). I know I can set the max heap space using the -Xmx argument for a run or external tool configuration in Eclipse, but that is a pain when I have several possible configurations that can be run.
I believe I would have to run in a separate JVM so my configurations don't get polluted with Eclipse classpath JARs and to a smaller extent, so the Eclipse JVM doesn't get polluted with configuration runs and all the class loading that goes on.
Is there a global setting to set the max heap available for all JVMs launched by Eclipse? For Ant, I tried setting ANT_OPTS in my environement to "-Xm1024m", but that setting doesn't seem to take when running Ant through Eclipse. If I run Ant from the command line directly, it does seem to work (or at least I didn't get an exception). When running Ant in verbose+debug mode in Eclipse, I do see "Setting project property: env.ANT_OPTS -> -Xmx1024m" so I know the variable is set.
I ran Java VisualVM to get a better idea what is going on, this is what it has:
JVM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01, mixed mode)
Java: version 1.7.0_25, vendor Oracle Corporation
Java Home: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre
JVM Flags: <none>
Main class: org.eclipse.ant.internal.launching.remote.InternalAntRunner
You can configure JVM arguments for an Eclipse Ant build in the Run > External Tools > External Tools Configurations dialog in the JRE tab.
Note that the default is actually to run Ant in the same JVM as Eclipse (which makes some additional Eclipse tasks available).
Running VisualVM made me realize Eclipse was still using 1.7.0_25 and not 1.7.0_45 which is the latest I have installed. Once I updated Eclipse to use 1.7.0_45, I no longer have the issue as the VM does indeed use 1/4 of total memory. Would be nice to know for sure, but it seems like build 25 had a bug or something.

Increasing Java Heap Size

I'm trying to increase value of heap size of my jvm, but it doesn't work. Could anybody help me with this geek problem?
My configuration are follow: Windows 7 x64, 4 GB, i3 CPU
When I try something like -Xmx2000M I have nothing
Where are my errors?
I think you are expecting this.
$ java -Xmx2000M -Xms1000M -XshowSettings:all
VM settings:
Min. Heap Size: 1000.00M
Max. Heap Size: 1.95G
Ergonomics Machine Class: server
Using VM: Java HotSpot(TM) 64-Bit Server VM
Your command is half correct. You need to specify what you want to run with an increased heap size. Something like this
java -Xmx2000M -Xms1000M -jar <jar-file-name>.jar
you need to specify as well which class/jar you want to run. You cannot just increase the heap size per default for all java pplications. Instead you have to edit the command line of the program you are trying to run.
The error you have got in the last screen shot is about unavailability of the class file to run.
You should provide class file which includes main function while running java command.
java -Xmx2000M -Xms1000m MyClass
Considering you have MyClass.class in your classpath.
You need to provide something for JVM to run with these new settings.
The arguments you are using only configure the JVM, it still needs whatever jar or class file you want to run.
To permanently configure JVM profile on windows, follow these Instructions. The settings tool will let you edit runtime parameters:
may be I am late)
But I think you can use it. In IDEA choose Edit Configuration... on drop-down list(look on picture below). And then type in VM Options your parameters -Xmx2000M -Xms1000M.
How to find Edit Configuration on IDEA

IntelliJ IDEA 12.0 JVM Startup Error

I just upgraded to IntelliJ IDEA 12.0 and get an error immediately upon attempting to launch:
The JVM could not be started. The maximum heap size (-Xmx) might be too large or
an antivirus or firewall tool could block the execution.
I checked my idea.exe.vmoptions file and the maximum heap size is only 640m (I have 8 GB physical memory and am not running any other applications).
idea.exe.vmoptions
-Xms128m
-Xmx640m
-XX:MaxPermSize=640m
-XX:ReservedCodeCacheSize=64m
-XX:+UseCodeCacheFlushing
-ea
-Dsun.io.useCanonCaches=false
I still have IntelliJ IDEA 11.4 on my machine and I am able to run that (using the same values for max heapsize in idea.exe.vmoptions). Since IntelliJ IDEA 11.4 runs, I don't believe it is an antivirus or firewall issue. I have also checked those settings as well.
Anyone run across this or have any idea (no pun intended)?
Please see this answer for the problem background and the solution.
Your questions seems to be the exact duplicate of:
How to increase intellij 32bit xmx more than 1GB?
Assuming you are on windows I am curious why you are running the 32bit version of intellij when you have a 64bit machine?
I was having the same error and found that there was two things going on. The first was that the link I had in the taskbar was pointing to the idea.exe instead of the idea64.exe, which meant I was only launching the 32bit version of intelliJ.
Second there is another file for vm options for the 64bit. idea64.exe.vmoptions
After switching to the 64bit exe and making sure the vm options I wanted were correct in the vmoptions file I did not have any further issues.
On another interesting note I found that on 32bit machines when the 32bit version of intelliJ was set to have 1gb of memory for -Xmx and I had chrome open I would get the error. If I closed chrome I would no longer get the error. I think this had something to do with the jvm verifying that the required amount of memory was available before launching.
Try to configure your idea to the default values
-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=64m
-XX:+UseCodeCacheFlushing
-ea
-Dsun.io.useCanonCaches=false
VM options are loaded from the IDE_HOME\bin\[bits][.exe].vmoptions file.
More info: https://intellij-support.jetbrains.com/entries/23393413-The-JVM-could-not-be-started-The-main-method-may-have-thrown-an-exception
I found that switching from a 32-bit version to a 64-bit version caused the issue, as my windows shortcuts still pointed to the old idea.exe and not the correct idea64.exe.

Categories

Resources