Created
February 2, 2011 08:32
-
-
Save gennad/807407 to your computer and use it in GitHub Desktop.
Object size fetcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment