aspose file tools*
The moose likes JBoss/WildFly and the fly likes JBoss AS 7: not starting because of memory? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JBoss AS 7: not starting because of memory?" Watch "JBoss AS 7: not starting because of memory?" New topic
Author

JBoss AS 7: not starting because of memory?

Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

I've just installed JBoss AS 7 onto Debian and launched it:

vz227:/usr/local/jbossas7# bin/standalone.sh
=========================================================================

JBoss Bootstrap Environment

JBOSS_HOME: /usr/local/jbossas7

JAVA: java

JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman

=========================================================================

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Hmm, out of memory. I then checked:


Shouldn't that be enough to create the VM?

Karsten


OCJP JavaSE 6 (86%)
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168


JAVA: java


What value have you set for JAVA_HOME? Post the output of:



[My Blog] [JavaRanch Journal]
Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

No value at all. Is it mandatory to set it? I tried to set it to /usr/bin/java, then standalone.sh would fail on line 135

"./standalone.sh: line 135: /usr/bin/java/bin/java: Ist kein Verzeichnis"

... is not a directory. True, it doesn't exist. Instead trying JAVA_HOME=/usr fails with the same error as in my OP.

What next? I tried -Xmx256m, that worked for now, but I'd really like to know why -Xmx512m isn't enough when I have 639 MB free. Is it because the perm size must be added to that value? Anything else hidden?

Karsten
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

Yes JAVA_HOME is necessary. What do you have in /usr/lib/jvm/? On my system that's where the default installation of JDK happens. You'll have to find where Java is installed and point JAVA_HOME to it.
Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

OK I set JAVA_HOME in ~/.bash_profile and it shows up.

When starting the server with the -Xmx512m I get the very same error as in my OP. (I did relogon!)

Karsten
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

You do not have enough memory to run with that heap and permgen sizesize. Add the two up and you have 768MB, yet you show only 639MB of free space. And that does not even count all of the other memory that the JVM needs to run.

Try decreasing both the permgen and the max heap size.


JBoss In Action
Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

This is what I thought: max + perm space, I wonder where such facts can be found...

So I'll have to do some math now, how to split up the ~640MB that I have left.

320 + 256 = 576 MB + small buffer, or should I do 384 + 192 perm or 320 + 192 perm. I'll just try I guess.

Thanks
Karsten
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

The best way to size the heap is to monitor it usage and size accordingly. JBoss in Action provides a lot of details about that (the performance tuning chapter is applicable even to JBoss AS 7). Much of the same information can be found in my CMG whitepapers:

Java Garbage Collection Statistical Analysis 101
Java Garbage Collection Performance Analysis 201
at http://www.cmg.org/cgi-bin/search.cgi?q=java+peter+johnson&x=30&y=10
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBoss AS 7: not starting because of memory?