At this link here
They describe memory leaks when using classloaders. Now this comment:
A classloader will be removed by the garbage collector only if nothing else refers to it. All classes hold a reference to their classloader and all objects hold references to their classes. As a result, if an application gets unloaded but one of its objects is still being held (e.g., by a cache or a thread-local variable), the underlying classloader cannot not be removed by the garbage collector!
I understand somewhat. But in the portion when they say:
(e.g., by a cache or a thread-local variable)
am I correct to say that by cache they mean a static reference and by threadlocal, they mean a non-static threadlocal variable. I say this because all code explanations of threadlocal memory leaks make the threadlocal variable as static. For example, this question in SO
My other question with the comment about cache is: a static variable will be GC-ed when application does down, so why does this present a problem?