Howdy, >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
Acceptable is subjective, and you're the one to decide. >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 Your understanding of this part is wrong, and if you're going to have servlets creating threads as part of request processing, this is important to understand correctly. >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 you create threads, you own them. Try not to create threads from a servlet, but use a middle object, e.g. a singleton bean, that encapsulates the functionality you need. Have it handle thread creation, monitoring, pooling, etc. Preferably use Doug Lea's concurrency library for this instead of writing your own. But as Tim said, none of this is substitute to simply profiling your app as is, seeing where memory is allocated and held. Yoav Shapira 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]
