First of all, I want to recommend the right tool for analyzing object layout schemes in JVMs - JOL . In your case ( java -jar jol-cli/target/jol-cli.jar internals java.util.BitSet ) JOL gives the following result:
Running 64-bit HotSpot VM. Using compressed references with 3-bit shift. Objects are 8 bytes aligned. Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] java.util.BitSet object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 4 (object header) 01 00 00 00 (00000001 00000000 00000000 00000000) (1) 4 4 (object header) 00 00 00 00 (00000000 00000000 00000000 00000000) (0) 8 4 (object header) f4 df 9f e0 (11110100 11011111 10011111 11100000) (-526393356) 12 4 int BitSet.wordsInUse 0 16 1 boolean BitSet.sizeIsSticky false 17 3 (alignment/padding gap) N/A 20 4 long[] BitSet.words [0] Instance size: 24 bytes (reported by Instrumentation API) Space losses: 3 bytes internal + 0 bytes external = 3 bytes total
Your calculations were not correct due to static fields, so an empty BitSet itself reserves 24 bytes. Please note that these calculations are not 100% accurate because the size of the long[] object was not taken into account. So, the correct results are java -jar jol-cli/target/jol-cli.jar externals java.util.BitSet :
Running 64-bit HotSpot VM. Using compressed references with 3-bit shift. Objects are 8 bytes aligned. Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] java.util.BitSet@6b25f76bd object externals: ADDRESS SIZE TYPE PATH VALUE 7ae321a48 24 java.util.BitSet (object) 7ae321a60 24 [J .words [0]
This means that an empty BitSet itself uses 48 bytes, including a long array. You can also get an approximate layout of the object in different modes of VM java -jar jol-cli/target/jol-cli.jar estimates java.util.BitSet