Gamigin, > Free memory: 2.17 MB Total memory: 5.84 MB Max memory: 63.56 MB > > I can't only have 2MB available after starting the server and not > even running my application.
If you have your starting heap size and maximum heap size set differently, then you will see this kind of thing all the time. The JVM only allocates heap space when it needs it. If you have a max heap size of 64MB, and you have only needed 5-6MB to load Tomcat, then you'll have 5-6MB of heap space allocated, some of it freed after startup (in your case, 2.17MB) and a comparitively huge max memory. The JVM will continue to allocate heap space as necessary until you hit that 64MB limit. At that point, the garbage collector will do a full GC in an attempt to free more memory in order to allow you to create more objects, etc. If the GC fails to free up enough memory by collecting old objects, they you're hosed: you get yourself an OutOfMemoryError. I hope that clears things up. Another poster suggested that you increase your max heap size. That is reasonable if your application actually needs more memory to function normally. I encourage you to analyze your memory needs and possibly increase the heap size to meet those needs. But, don't just jack up the heap size because you are running out of memory; you might have a resource leak, and they're a lot easier to track down and fix with a smaller heap than a larger heap ('cause you can run out of memory faster ;). -chris
signature.asc
Description: OpenPGP digital signature