Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

tomcat 5.0.24 out of memory. editing registry. why is this so complicated?

843841Jun 2 2004 — edited Jun 18 2004
I'm running tomcat 5.0.24 as a service on windows XP and I need to increase the amount of memory available. It appears that the only way to do this is to edit the registry.

So I opened regedit and navigated to:
HKEY_LOCAL_MACHINE  >>  SOFTWARE  >>  Apache Software Foundation  >>  Procrun 2.0  >>  Tomcat5  >>  Parameters  >>  Java
Under the Java element there are seven values:
Name        Type            Data
----------------------------------------------------------
(Default)   REG_SZ          (value not set)
Classpath   REG_SZ          C:\tomcat5\bin\bootstrap.jar
Jvm         REG_SZ          C:\j2sdk1.4.2_03\jre\bin\server\jvm.dll
JvmMs       REG_DWORD       0x00000100 (256)
JvmMx       REG_DWORD       0x00000100 (256)
JvmSs       REG_DWORD       0x00000100 (256)
Options     REG_MULTI_SZ    -Dcatalina.home=C:\tomcat5 -Djava.endorsed.dirs=C:\tomcat5\common\endorsed -Djava.io.tmpdir=C:\tomcat5
Now the JvmMx, JvmMx, and JvmSs values were all initiall 0 and I had initially changed them each to decimal 256,000,000 but when I did this tomcat would not start as a service and I found my logs contained the following error:
[2004-06-02 13:02:43] [info] Starting service...
[2004-06-02 13:02:43] [info] JNI Invalid initial heap size: -Xms256000000m
[2004-06-02 13:02:43] [415  javajni.c] [error] CreateJavaVM Failed
[2004-06-02 13:02:43] [770  prunsrv.c] [error] Failed initializing java C:\Tomcat5\bin\bootstrap.jar
[2004-06-02 13:02:43] [982  prunsrv.c] [error] ServiceStart returned 2
This was actually an encouraging error, I thought, since it indicated that I had gone to the correct place to set the heap size. Now all I had to do was provide a reasonable value. So I changed 256,000,000 to 256 (which is the value they are at now and the value I recorded above when copying down the regedit parameters) and tried again.

Tomcat now starts just fine, but when I tested the memory allocations using the following code in the init method of one of my servlets it indicated that the memory settings had not been increased.

Here is the code from the init method.
Runtime rt = Runtime.getRuntime();
System.out.println("Max Memory  :" + rt.maxMemory() );
System.out.println("Free Memory :" + rt.freeMemory() );
System.out.println("Total memory:" + rt.totalMemory() );
Here is what it printed:
Max Memory  :66650112
Free Memory :11874424
Total memory:59592704
So I have tried to increase the memory available to tomcat and have failed. If someone can tell me what I'm doing wrong I'll be remarkably impressed.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 16 2004
Added on Jun 2 2004
8 comments
578 views