But why is Tomcat taking so much memory? I'm running it as a service on a
windows 2000 box and you can see the memory usage of the Tomcat.exe go up
AND down depending on the number and nature of requests. But my servlet that
spawns another thread sends the memory use through the roof and it never
comes back down.

> -----Original Message-----
> From: Tim Funk [mailto:[EMAIL PROTECTED]
> Sent: 22 July 2003 11:49
> To: Tomcat Users List
> Subject: Re: Threading problem in servlets
>
>
> JVM's take memory from the OS and never release it back to the
> OS. The JVM
> itself may have tons of memory free, but the OS won't know that.
>
> -Tim
>
> Tom Lyle wrote:
> > Hi there,
> >
> > I'm hoping that someone can help me with a memory/threading problem im
> > having with Tomcat. I have an application that does a lot of heavy xml
> > processing and I'm trying to make this work as a web app within Tomcat.
> > Basically I have a process that does the following:
> >
> > 1. Loads an xml file into the DOM
> > 2. Xpaths to find a list of particular Nodes
> > 3. For each Node run an XSL transform on the document to generate an
> > individual html page
> >
> > For example, I have a 3mb xml document that i run through this
> process which
> > generates 54 html pages. I've encapsulated this process in a class that
> > implements the Runnable interface so i can kick the process off in a new
> > thread (as it can take some time) and when I run the process on my local
> > machine in Eclipse the memory usage ramps up to around 70mb until it
> > completes. Now i reckon this is acceptable considering the
> amount of work
> > thats going on. The problem comes when i try to invoke my Runnable class
> > from a servlet. Tomcat goes crazy with the memory usage
> fluctuating wildly
> > between 50-450mb and by the time the process has completed
> (which it does)
> > my Tomcat.exe is hogging over 400mb of memory and refuses to give it up,
> > which means i'm left with no alternative but to restart.
> >
> > My understanding of the servlet lifecycle is that for each requst to a
> > servlet a new instance of the servlet class is created in its
> own thread and
> > that the servlet container my maintain a pool of these threads,
> reusing them
> > as requests come in. What i'm not sure about is what happens to
> any threads
> > that the servlet may create (as in my case) It would seem that Tomcat is
> > preventing my xml processing thread from being properly cleaned up.
> >
> > If any one has any ideas/suggestions i'd be most grateful
> >
> > Tom
>
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to