Wednesday 12 November 2014

BTrace trace ClassLoader Leaking

If you want to trace the common ClassLoader leaking, you just probe where to invoke "ClassLoader#defineClass". The BTrace script as follow:
import com.sun.btrace.AnyType;
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;

public class Trace {

   @OnMethod(clazz = "+java.lang.ClassLoader", 
             method = "defineClass")
    public static void traceClassLoaderLeak(@ProbeClassName String clazz, @ProbeMethodName String method, @TargetInstance Object instance) {
        println("\n==== java.lang.ClassLoader#defineClass ====");

No comments:

Post a Comment