Class ObjectSizeOfAgent


  • public class ObjectSizeOfAgent
    extends Object
    Instrumentation agent for calculating object sizes using Java's instrumentation API. To use it, have the jar somewhere we you can access it (just having this class on the classpath is not enough) and startup your application with a -javaagent argument like e.g: '-javaagent:/mydir/wicket-objectsizeof-agent-1.3-SNAPSHOT.jar'. When the application starts up, this agent will register an WicketObjects.IObjectSizeOfStrategy at WicketObjects.setObjectSizeOfStrategy(IObjectSizeOfStrategy). Note that this is a static registration.
    Author:
    eelcohillenius
    • Method Detail

      • agentmain

        public static void agentmain​(String agentArgs,
                                     Instrumentation instrumentation)
        Initializes agent when it is attached to an already running JVM.
        Parameters:
        agentArgs - Arguments passed in to the agent
        instrumentation - The instrumentation class
      • premain

        public static void premain​(String agentArgs,
                                   Instrumentation instrumentation)
        Initializes agent before the main function of the application is executed.
        Parameters:
        agentArgs - Arguments passed in to the agent
        instrumentation - The instrumentation class