Each array is really a pointer to an array (hence the references), then we are taking account of the overhead of the 'bytes' array itself.
And I see 3 integers pasted in, so things are looking good to me.... On Sun, Jul 31, 2011 at 10:01 PM, Akash Ashok <thehellma...@gmail.com> wrote: > Hi, > I was going thru the heapSize() method in the class KeyValue and i > couldn't seem to understand a few things which are in bold below > > > private byte [] bytes = null; > private int offset = 0; > private int length = 0; > private int keyLength = 0; > > // the row cached > private byte [] rowCache = null; > > // default value is 0, aka DNC > private long memstoreTS = 0; > * @return Timestamp > */ > private long timestampCache = -1; > > > public long heapSize() { > return ClassSize.align( > // Fixed Object size > ClassSize.OBJECT + > > * // Why this ????? > (2 * ClassSize.REFERENCE) +* > > // bytes Array > ClassSize.align(ClassSize.ARRAY) + > > //Size of int length > ClassSize.align(length) + > > * // Why this ?? There are only 2 ints leaving length which are int ( > offset, length) > (3 * Bytes.SIZEOF_INT) + > * > // rowCache byte array > ClassSize.align(ClassSize.ARRAY) + > > // Accounts for the longs memstoreTS and timestampCache > (2 * Bytes.SIZEOF_LONG)); > } >