One possible approach can be that 1. Have a custom bundle listener. This would maintain some structure around bundle 2. Use Java Phantom reference [1] to register a callback for GC of classloader associated with the bundle. Upon gc callback we remove the information
Then have a web console plugin which can look into the current data structure maintained by the listener. It would then check the state against actual active bundle and flag the suspects. And if left over a period of time can easly mark out stale bundles which are leaking. Should not incur any performance cost Chetan Mehrotra [1] http://docs.oracle.com/javase/7/docs/api/java/lang/ref/PhantomReference.html
