I am confused about the following question associated with memory allocation:
Assume that an object of class Circle occupies 64 bytes in memory. A reference variable occupies 8 bytes in memory. How many bytes are allocated in memory when the following line of code is executed?
Circle[] myCircleList = new Circle[10];
The correct answer is 88.
For now, my understanding is that 10 elements inside the myCircleList are reference pointer for Circle object that haven't been declared yet, so there are 8*10 = 80 bytes of memory allocated for them. Meanwhile, myCircleList is also a reference pointer in the stack, which is pointing to the array of object in heap, thus itself occupies 8 bytes. So a total of 88 bytes memory is allocated to this line of code.
However, I am uncertain about my understanding after reading this answer, and wonder if an additional of 8 bytes are required for storing the array length and alignment.
Is my understanding of the answer correct?