Presentation is loading. Please wait.

Presentation is loading. Please wait.

Finding Class Loader Leaks in Java Applications Jevgeni Kabanov.

Similar presentations


Presentation on theme: "Finding Class Loader Leaks in Java Applications Jevgeni Kabanov."— Presentation transcript:

1 Finding Class Loader Leaks in Java Applications Jevgeni Kabanov

2 Based on Work in progress on class loader leak detection tool “Computing Dominators and Dominance Frontiers” by P. Briggs, T. Harvey “A Fast Algorithm for Finding Dominators in a Flowgraph” by T. Lengauer and R. Tarjan “A Simple, Fast Dominance Algorithm” by Cooper et al

3 Class loader API public abstract class ClassLoader { public Class loadClass(String name); protected Class defineClass(byte[] b); public URL getResource(String name); public Enumeration getResources(String name); public ClassLoader getParent() }

4 Class loading public class A { public void doSmth() { B b = new B(); b.doSmthElse(); } Causes a call to A.class.getClassLoader().loadClass(“B”);

5 Java EE Delegation ContainerApp1.earWAR1WAR2App2.earWAR3App3.earWAR4

6 Reloading an Object MyObject MyObject.clas s OldClassLoade r NewClassLoad er MyObject.clas s MyObject Recreate the object

7 Leaking ClassLoaders Class1.class ClassLoader Class2.class Class3.class Static Fields

8 Leaking ClassLoaders Leak Leak.class ExampleFactory$1 Example.class

9 Web Deployment Classes Libraries OldClassLoader NewClassLoader Sevlet New Classes New Libraries Sevlet Session init() App State Serialize/deserialize

10 Leak detection How are leaked class loaders different?

11 Dominators What are dominators useful for? –SSA –CPS Naïve algorithm O(N^2) Fixpoint algorithm O(N^2) Lengauer-Tarjan O(E logN)

12 FIXPOINT

13

14 Lengauer-Tarjan

15

16

17 1.Construct the DFS tree and give each node a depth-first index O(E) 1.Compute semidominators using TABA O(E) 2.Compute the dominators from the semidominators O(E) 1.Find minimum along the path = O(log N)


Download ppt "Finding Class Loader Leaks in Java Applications Jevgeni Kabanov."

Similar presentations


Ads by Google