# java-sizeof **Repository Path**: renqingchina/java-sizeof ## Basic Information - **Project Name**: java-sizeof - **Description**: No description available - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-19 - **Last Updated**: 2021-09-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # java-sizeof a simple class, used to calculate java Object size, implemented by JDK above 1.5, resolved the manifest.mf file add pre-class attr problem . origin doc refer https://www.baeldung.com/java-size-of-object # quickStart 1.clone code & build in your maven repository
2.import this jar file to your maven project by pom.xml
3.config run/debug arguments, add -javaagent:"ClassPath\InstrumentationAgent-0.0.1-SNAPSHOT.jar" to VM Options
4.import cn.com.instrument.InstrumentationAgent;
5.insert ref code:
```java public static void printObjectSize(Object object) { System.out.println("Object type: " + object.getClass() + ", size: " + InstrumentationAgent.getObjectSize(object) + " bytes"); } 6.start run/debug