The "java" command line option you want is actually "-Xmx256m" to set the
maximum heap size. To set this, you can establish an environment variable
named TOMCAT_OPTS (Tomcat 3.x) or CATALINA_OPTS (Tomcat 4.x) that contains
the command line options to be sent to the JVM. For example:
export TOMCAT_OPTS="-Xmx256m"
$TOMCAT_HOME/bin/tomcat.sh start
Craig McClanahan
On Sat, 25 Aug 2001, Max Hugen wrote:
> Date: Sat, 25 Aug 2001 13:00:41 +1000
> From: Max Hugen <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED], Max Hugen <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: OutOfMemory - Set Java Heap Size?
>
> I run Linux/Apache/Tomcat plus Oracle on a server with 512Mb of memory. I
> have successfully implemented a couple of Internet applications using JSP,
> Servlets (plus Oracle) etc.
>
> For each application (and client) I start a new Tomcat session, using a
> custom server.xml for each one. All was ok, until I tried increasing Tomcat
> sessions from 6 to 7, then I received the java.lang.OutOfMemoryError when
> starting the Tomcat sessions.
>
> I've read through many of the posts on this subject, some of which suggest
> to increase the "heap" size. Unfortunately, I'm a newbie to Java (and Linux
> and JSP and Oracle <g>) so I don't know how to either check this heap size,
> nor how to permanently set it to a value via a script using a switch
> like -Xms256m.
>
> The script I use to start Tomcat follows, plus the console output. Could
> anyone advise how to set the heap please?
>
>
> Many thanks,
>
> Max Hugen [EMAIL PROTECTED]
> Hugen Enterprises Pty Ltd, Sydney, Australia
> www.hugen.com.au
> Internet Application Developers
>
> >>>>>>>>>Script Start>>>>>>>>
> echo "~~~~~~~~Tomcat Startup ~~~~~~~~~~~~~"
> echo "Start an instance of Tomcat for hugen"
> /usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_he.xml
> echo "Start an instance of Tomcat for yass3i"
> /usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_yass3i.xml
> echo "Start an instance of Tomcat for isp"
> /usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_isp.xml
> echo "Start an instance of Tomcat for im2000i"
> /usr/local/tomcat/bin/startup.sh -f
> /usr/local/tomcat/conf/server_im2000i.xml
> echo "Start an instance of Tomcat for secure"
> /usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_secure.xml
> echo "Start an instance of Tomcat for aedo"
> /usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_aedo.xml
> echo "Start an instance of Tomcat for ncap"
> /usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_ncap.xml
> # Give Tomcat time to start before restarting Apache.
> echo "Waiting 45 secs..."
> sleep 45
> # Restart Apache to register Tomcat properly.
> echo "Restart Apache"
> /etc/rc.d/init.d/httpd stop
> /etc/rc.d/init.d/httpd start
> sleep 2
> echo "Ok, we should be in business!"
> >>>>>>>>>Script End>>>>>>>>
>
> >>>>>>>>>Console Output Start>>>>>>>>
> Starting tomcat. Check logs/tomcat.log for error messages
> Starting tomcat. Check logs/tomcat.log for error messages
> Starting tomcat. Check logs/tomcat.log for error messages
> Starting tomcat. Check logs/tomcat.log for error messages
> Starting tomcat. Check logs/tomcat.log for error messages
> Starting tomcat. Check logs/tomcat.log for error messages
> Starting tomcat. Check logs/tomcat.log for error messages
>
> Restart Apache
>
> Exception in thread "main" java.lang.OutOfMemoryError: unable to create new
> native thread
> at java.lang.Thread.start(Native Method)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.<init>(ThreadPool.java:465
> )
> at
> org.apache.tomcat.util.ThreadPool.openThreads(ThreadPool.java:360)
> at org.apache.tomcat.util.ThreadPool.start(ThreadPool.java:148)
> at
> org.apache.tomcat.service.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java
> :245)
> at
> org.apache.tomcat.service.PoolTcpConnector.start(PoolTcpConnector.java:188)
> at
> org.apache.tomcat.core.ContextManager.start(ContextManager.java:527)
> at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:202)
> at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
>
> Exception in thread "main" java.lang.OutOfMemoryError: unable to create new
> native thread
> at java.lang.Thread.start(Native Method)
> at
> org.apache.tomcat.util.ThreadPool$MonitorRunnable.<init>(ThreadPool.java:382
> )
> at org.apache.tomcat.util.ThreadPool.start(ThreadPool.java:149)
> at
> org.apache.tomcat.service.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java
> :245)
> at
> org.apache.tomcat.service.PoolTcpConnector.start(PoolTcpConnector.java:188)
> at
> org.apache.tomcat.core.ContextManager.start(ContextManager.java:527)
> at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:202)
> at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
>
> Shutting down Web Service: httpd
>
> /etc/rc.d/init.d/httpd: fork: Resource temporarily unavailable
> Web Service: /usr/sbin/httpd
>
> >>>>>>>>>Console Output End>>>>>>>>
>
>