-   Debian (
-   -   Can't start the Java Virtual Machine - memory problem? (

the182guy 04-01-2009 07:15 AM

Can't start the Java Virtual Machine - memory problem?
Hi all,

Basically I can't start the JVM on a remote dedicated Debian server. I am using SSH to issue the commands, there is no desktop UI.

The error I'm getting is:

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

When I check memory usage, there seems to be plenty available, but no swap:

            total      used      free    shared    buffers    cached
Mem:          3937        248      3688          0          0          0
-/+ buffers/cache:        248      3688
Swap:            0          0          0

What I'm actually doing is trying to run "Liferay Portal" which is an application that runs under Tomcat. When I execute the the above error can be found in the log.

Any help is appreciated, thanks!

crabboy 04-01-2009 08:24 AM

Sounds like the initial size of the heap, specified with -Xmx is too large for your machine. Look in the to see if there is a value specified. It should be assigned to the JAVA_OPTS variable.

the182guy 04-01-2009 08:42 AM

crabboy, thanks for your suggestion.....

the script calls a script that runs this command (sets environment variables):


JAVA_OPTS="$JAVA_OPTS -Xmx1024m -XX:MaxPermSize=256m -Dfile.encoding=UTF8 -Duser.timezone=GMT$CATALINA_HOME/conf/jaas.config -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false"
There's the value of xmx that you mentioned above.

crabboy 04-02-2009 07:49 AM

You can try a lower number like 512M and see if it helps, but I don't see a problem with the way it is now. That allows the JVM to start small and allocate up to 1G of RAM. What version of java are you using?

java --version

the182guy 04-03-2009 02:54 AM

thanks crabboy,

I tried lowering it to a lot of different values. 512M did get past the first VM error and it tried to start, but it went on to have more memory problems 'Cannot allocate memory'. The Liferay software wasn't functional - tried to get to the portal homepage on localhost:8080 but it just hung.

A couple of times the server went unstable, refusing all commands and eventually kicking me out of SSH and not letting me back on. Had to log onto plesk to kill the java process before it would let me back on SSH.

Edit: java version is latest (6.x I think), I downloaded and installed the latest JRE and JDK.

Oh also.. I actually think it might be a Fedora server now, but not 100% sure.

crabboy 04-03-2009 12:16 PM

does the user that you're using have any ulimits set?

$ ulimit -a

If there are memory limits, set them to unlimited. I don't see why the system would hang and you'd get thrown out though. What does top look like when you start tomcat?

All times are GMT -5. The time now is 09:45 PM.