RE: Garbage Collection issues
Howdy, Perhaps you are experiencing higher load, which requires more memory. Or perhaps your application does have a memory leak: those are possible and occur in java, so yes that would a programming error on your part. The garbage collector does much magic, but it can't save you all the time. You may wish to read up on java memory leaks, as they've been discussed at length on this list and on the net in general. Note that when you call Runtime#gc that's only a suggestion to the JVM: many times when you call that the garbage collector may not run at all. Yoav Shapira Millennium ChemInformatics -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 8:21 PM To: 'Tomcat Users List' Subject: Garbage Collection issues My Tomcat 4.1 (hosted on Linux) seems to have a problem in recent months with crashing due to unavailable free RAM. Specifically I get a java.error.outOfMemory exception. If check the RAM available (Runtime.getRuntime().totalMemory()), I can see it ticking down through the week. If explicitly run garbage collection however my RAM totally frees up and all is well (Runtime.getRuntime().gc();). Why would this happen? Surely this isn't due to a programming error on my part, otherwise, the resources should automatically released whenever the JRE performs periodic garbage collection. Isn't that correct? Anyone have any theories as to what this may mean and what the best solution would be? Thanks. Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Garbage Collection issues
When I said that surely it can't be a memory leak in my app I was operating under the assumption that the JRE runs garbage collection periodically anywayis this not true? If I was waisting resources and not releasing them in a way that the GC could take them back when it runs automatically then why would it take them back when I call garbage collection explicitly? To me, this suggested more of a systemic issue. It was suggested by someone last night that I may want to look at some config lines to make sure GC is active and this seemed in line with my assumption. Is there something else here that I may be missing however? Can you see a possible explanation as to why my app's waisted resources would not get cleaned up until I explicitly ran GC? Thanks. Neal Shapira, Yoav [EMAIL PROTECTED] wrote: Howdy, Perhaps you are experiencing higher load, which requires more memory. Or perhaps your application does have a memory leak: those are possible and occur in java, so yes that would a programming error on your part. The garbage collector does much magic, but it can't save you all the time. You may wish to read up on java memory leaks, as they've been discussed at length on this list and on the net in general. Note that when you call Runtime#gc that's only a suggestion to the JVM: many times when you call that the garbage collector may not run at all. Yoav Shapira Millennium ChemInformatics -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 8:21 PM To: 'Tomcat Users List' Subject: Garbage Collection issues My Tomcat 4.1 (hosted on Linux) seems to have a problem in recent months with crashing due to unavailable free RAM. Specifically I get a java.error.outOfMemory exception. If check the RAM available (Runtime.getRuntime().totalMemory()), I can see it ticking down through the week. If explicitly run garbage collection however my RAM totally frees up and all is well (Runtime.getRuntime().gc();). Why would this happen? Surely this isn't due to a programming error on my part, otherwise, the resources should automatically released whenever the JRE performs periodic garbage collection. Isn't that correct? Anyone have any theories as to what this may mean and what the best solution would be? Thanks. Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Free Pop-Up Blocker - Get it now
Re: Garbage Collection issues
Neal, When I said that surely it can't be a memory leak in my app I was operating under the assumption that the JRE runs garbage collection periodically anywayis this not true? The GC is pretty much free to run whenever it wants. Often, it will not run until you get very close to running out of memory. Actually, most modern GCs run all the time, but do very little work. They free-up short-leved objects and only re-claim a very small amount of memory. After some longer-lived (and dead) objects accumulate on the heap, then the GC does a full GC and the heap goes *way* down (this is likely to be what you see when you force a GC). If I was waisting resources and not releasing them in a way that the GC could take them back when it runs automatically then why would it take them back when I call garbage collection explicitly? Did this forced GC helps situation happen in a dev environment or in production? To me, this suggested more of a systemic issue. It was suggested by someone last night that I may want to look at some config lines to make sure GC is active and this seemed in line with my assumption. Is there something else here that I may be missing however? Can you see a possible explanation as to why my app's wasted resources would not get cleaned up until I explicitly ran GC? As I said, sometimes the GC takes it's sweet time. What, if any, memory settings do you use, and do you use any GC specific settings? For debugging purposes, it's often helpful to enable verbose GC -- check your VM's command-line options for how to enable that. Many production deployments set both the min and max heap sizes to the same power-of-two setting (i.e. 128M, 256M, 1024M, etc.) -chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]