There are several things you can do (on 1.3.1 and after): 1. Make sure your global and local class parms are explicitly set to null after the work is being completed 2. Heavily used classes should provide their own finalize methods 3. You will need to call JVM to run finalization and recommend JVM to run the GC. (System.runFinalization() and System.gc() ). However, be very careful with these methods since specially System.runFinalization() might clean up the objects that you still need. 4. Use -server option for HotSpot since it's GC is much better than regular GC 5. If all above does not work, then try using java.lang.ref.Reference package to explicitly define your reference types so they would easily be collected by the GC (weak references, unreachable object etc.) 6. do NOT set Xmx and Xms to "same" value 7. Look at -XX options of the JVM and do more reading abouts eden, young, old generations. Some options are XX:SurvivorRatio and XX:SoftRefLRUPolicyMSPerMB
-----Original Message----- From: Donie Kelly To: 'Tomcat Users List' Sent: 9/27/02 6:12 AM Subject: HOW TO: How do I allocate memory in JVM for extra virtual hosts Hi all I am running tomcat 4.0.1 with virtual hosting and was wondering how much memory to allocate to each additional host. By default, we use 64M for one host but adding another 64M for second host seems excessive considering it's the same tomcat instance. However, if we add a lot the JVM will use more memory before garbage collection and we've seen a 30 second (!!!) delay when using 1G Ram on JVM as it just kept using memory until it ran out. It then had almost 1G of ram to garbage collect. How can I force garbage collection to be more aggressive and do it more often when garbage is small enough not to cause a problem? As we need this to run in a production environment we cannot possible allow a JVM to go for a garbage break for 30 seconds!!!! Any insight or help is greatly appreciated. Donie -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
