But also if it is taking an hour before you run out of memory then it sounds as if you may have a memory leak - there is a profiler plugin available for netbeans 4.1 which is quite handy for tracing these - I don't think its on the netbeans update centre but you should find it if you search on the net. Its free.
-----Original Message----- From: Stracchino, Peri Sent: 30 January 2006 17:55 To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: OutOfMemoryError - how to increase heap size Not sure about when using init.d and/or running from netbeans, but generaly you need to use the catalina.bat file if starting tomcat from the startup.bat (add the line 'set CATALINA_OPTS=-msxxxm -mxxxxm' where xxx represents the minimum and maximum values you want) or, if you are running it as a windows service, use the Configure Tomcat interface (right click on your tomcat icon or go to your start menu) and go to the java tab, then set the initial and maximum memory fields. -----Original Message----- From: Aparna Ramakrishnan [mailto:[EMAIL PROTECTED] Sent: 30 January 2006 15:15 To: tomcat list Subject: OutOfMemoryError - how to increase heap size Hello, I use a Asterisk-JAVA API program which on a random basis, calls a Servlet, using Tomcat5, in order to set forwarding of calls through an Asterisk PBX Server. Two threads run throughout the program, where one is an endless thread. I use JDBC onnection with MySql. An hour after the program has been run, it gives an OutOfMemoryError - and hence the servlet is not called and hence CallForwarding is not set. But again randomly, it works but at other times sends an OutOfMemoryError. On the start of the program, I check the Runtime.getRuntime().totalMemory() --> arnd 1.9 MB Runtime.getRuntime().maxMemory() --> arnd 64 MB Runtime.getRuntime().freeMemory() --> arnd 1.4MB After the totalMemory reaches 64 MB, and freeMemory is less than 34556 bytes, the java.lang.OutOfMemoryError is thrown. Since I am completely new to both JAVA and tomcat, I would like to know how I need to proceed. I believe I must increase the maxMemory -- but how and where? I start Tomcat5 using /etc/init.d/tomcat5 start . I run the JAVA program using Netbeans IDE 4.1 and not via command line. I read somewhere that the option -Xms128m -Xmx256m should be set for JAVA_OPTS environment variable in the startup script used to starting tomcat. But I dont seem to understand where I can add this value in /etc/init.d/tomcat5 file. Kindly guide me further. Any help appreciated. Thanks in advance Aparna --------------------------------- Do you Yahoo!? With a free 1 GB, there's more in store with Yahoo! Mail. ************************************************************************ ** Experience the British Library online at www.bl.uk Help the British Library conserve the world's knowledge. Adopt a Book. www.bl.uk/adoptabook The Library's St Pancras site is WiFI - enabled ************************************************************************ ** The information contained in this e-mail is confidential and may be legally privileged. It is intended for the addressee(s) only. If you are not the intended recipient, please delete this e-mail and notify the [EMAIL PROTECTED] : The contents of this e-mail must not be disclosed or copied without the sender's consent. The statements and opinions expressed in this message are those of the author and do not necessarily reflect those of the British Library. The British Library does not take any responsibility for the views of the author. ************************************************************************ ** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]