|
From: Dain S. <da...@iq...> - 2005-06-15 20:55:04
|
On Jun 15, 2005, at 1:23 PM, John Watson wrote: > The real question (IMHO) is why thread-pool vendors don't clear > threadlocals! I do agree that it can be very dangerous to use > theThreadLocal. You do need to know what you're doing when you use > them. I wish that vendors would help protect us from our own > sloppiness,though. From what I heard, Websphere used to do exactly that (you just use setAccesable and clear the hashmap). The problem was that way too much of their customer's code depended on thread locals not being cleared. Customers were doing dumb stuff like using it for a cache between requests. Anyway, I agree with Juergen; the problem is improper use of thread locals. I just recently fixed a bunch of memory leaks in Geronimo do to poor thread local handling. BTW a related issue is clearing the context class loader as it can cause class loaders to not be garbage collected. Basically any thread state needs to be carefully managed since they are GC roots. -dain |