|
From: Guillaume P. <gpo...@gl...> - 2004-10-21 22:25:22
|
> I only wish A) there was a way to explicitly blow away the classloader > or B) have hibernate be redeployable. One option is to place all the > Hibernate related classes inside Tomcat's shared Classloader. This > might reduce the amount of times I need to restart. Well, if you care enough, I'm pretty sure you could create a ContextListener that would cleanup when the context is destroyed. It would invole reflection to hack in private fields of the Threads though, so the solution might fail in different JVM, and wouldn't work well with SecurityManagers. Basically, what you would have to do is to get the list of all the system's thread (through ThreadGroup), and for each of them, iterate the "threadLocals" map, and the "inheritableThreadLocals", to cleanup any instance for which the ClassLoader is the current webapp or of child of it. You might also have to cleanup a few other things though, such as if you have any JDBC drivers in your webapp's ClassLoader, they need to be explicitly unregistered, otherwise they will not be garbage collected. I create a prototype of a ContextListener that does that if you want. Guillaume ----- Original Message ----- From: "Seth Ladd" <set...@gm...> To: <spr...@li...> Sent: Wednesday, October 20, 2004 2:26 PM Subject: Re: [Springframework-developer] CGLIB memory usage within class loader > On Tue, 19 Oct 2004 22:10:20 -0400, Guillaume Poirier > <gpo...@gl...> wrote: >> > How does it not create a leak if the classloader is not going away? >> > The real cause of the OOM exceptions is that the WebappClassLoader >> > instances never go away. >> >> I meant if the container (e.g. Tomcat) doesn't throw the ClassLoader >> away, >> i.e. if it's still in use... >> Of course, if the webapp is reloaded and the old ClassLoader isn't >> collected, that's a leak. >> >> What I was saying is the problem with Dom4j cause a leak when you reload >> the >> webapp, >> but cause no leak if you never use hot-reload. (While the CGLIB leak >> apparently does the opposite) > > Ahh... that's what I thought. Thanks for the clarification! > > I only wish A) there was a way to explicitly blow away the classloader > or B) have hibernate be redeployable. One option is to place all the > Hibernate related classes inside Tomcat's shared Classloader. This > might reduce the amount of times I need to restart. > > Seth > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > Use IT products in your business? Tell us what you think of them. Give us > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out > more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer |