title: What is premain() and how does it get called?
body: <p>I have never heard of a <code>premain</code> and I feel a little stupid to ask but <a href="https://stackoverflow.com/questions/9368764/calculate-size-of-object-in-java">the answer of this post</a> suggests to run it in order to get the <code>Instrumentation</code> object. </p>
  
  <p>But how does that function get called or how do I make it getting called?</p>
  
  <pre><code>package playground;
  import java.lang.instrument.Instrumentation;
  
  public class ObjectSizeFetcher {
      private static Instrumentation instrumentation;
  
      public static void premain(String args, Instrumentation inst) {
          instrumentation = inst;
      }
  
      public static long getObjectSize(Object o) {
          return instrumentation.getObjectSize(o);
      }
  }
  </code></pre>