Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 68309 invoked by uid 500); 7 May 2001 11:00:05 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 68173 invoked from network); 7 May 2001 10:59:52 -0000 Received: from dorfesel.dorf.rwth-aachen.de (root@134.130.59.5) by h31.sny.collab.net with SMTP; 7 May 2001 10:59:52 -0000 Received: from dorf.rwth-aachen.de (speedy.dorf.rwth-aachen.de [134.130.59.112]) by dorfesel.dorf.RWTH-Aachen.DE (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) with ESMTP id MAA26788; Mon, 7 May 2001 12:59:48 +0200 Message-ID: <3AF68024.DA86F7AC@dorf.rwth-aachen.de> Date: Mon, 07 May 2001 12:59:48 +0200 From: Wolle Reply-To: mwollenhaupt@web.de X-Mailer: Mozilla 4.77 [en]C-CCK-MCD DT (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: eric chacon , tomcatUser Subject: Re: My growing memory problem resolved References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Hei Eric, thank you for your reply, i will answer your questions below: eric chacon wrote: > Wolle, > > I think the problem may lie in your JVM: Setting a reference to the object > to null does not automatically free the memory--it just allows the garbage > collector to clear it whenever it runs. > > In many (most?) JVMs, garbage collection is single-threaded. It may run at > a fairly low priority. this was tested with JDK1.3.0_02 (Hotspot Server/client) and IBMJava2_1.3 > > > Therefore, under stress testing, it is possible for you to eat up a lot of > memory before the garbage collector has a chance to pool it. Yes, of course, I gave it a half day an nothing becomes free. I had also see, that all process was cloesd (tool top under Linux). > > > One way to test this would be to let your process run under high load, and > then stop your load and watch over time to see if the memory is released. > > If, in fact, it is a garbage collection problem, you have a couple of > choices: 1) upgrade your JVM and see if that helps. 2) pool your Heavy > Objects: create a store of them, and re-use them. > I have done something else, I have synchronize the Object and use create only on Object: class Servlet extends HttpServlet{ HeavyObject ho = null; public doPost(request,response) throws IOException{ if (ho != null){ ho = new HeavyObject(); } } } that works, so the Object will only created once, but I have to synchronize the Object. > > If you're doing load balancing/workload management, this might cause some > problems (you'll need to persist your objects to a common database), but if > everything's running on one machine, pooling might be an easy, convenient > solution. > > Cheers, > Eric > thanks and Greetings, Michael > > >From: Wolle > >Reply-To: mwollenhaupt@web.de > >To: tomcatUser > >Subject: My growing memory problem resolved > >Date: Mon, 07 May 2001 03:45:55 +0200 > > > >Hello , > >i have posted for a few day's a problem thats the Memory usage will > >extremly grow up when I refresh a page very often > >The Problem was, that I creat a "heavy memory" Object on each refresh. > >Normally I have 81 processes run at all, when execute the "stress-test" > >the processcount will rise till ~ 230. And each new Prcoesses will creat > >a new Object. > >When I stop the stress-test, the processcount becomes normal (~ 100) , > >but the memory usage won't fall. > >But the new created Object have now refernces that points to them. > >But why they don't becomes free ???? My code is somthing like this: > > > >public class servlet1 extends HttpServlet{ > > .. > >... > >.. > >.. > > public void doPost(HttpServletRequest request,HttpServletResponse > >response) > > throws IOException{ > > try{ > > HeavyObject ho = new HeavyObject(); > > } > > finally{ > > ho = null; // for testing implementet, but this gives the > >memory not free, also > > } > > > > } > >} > > > >Is this a Bug in Tomcat ? Or is it a Bug from me ? Or som Java > >misunderstood ? > >Why will the Object not becomes free, when some of the Threads will be > >closed , > >and the only reference is in the closed Thread ? > > > > > >Greetings, > >Michael > > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com