How many bytes an array occupies in Java? Assume It's a 64bit machine and also assume there are N elements in an array, so all these elements would take up 2*N, 4*N or 8*N bytes for different types of array.
And a lecture in Coursera says that it would occupy 2*N+24, 4*N+24 or 8*N+24 bytes for a N element array and the 24 bytes is called overhead, but didn't explain why the overhead is needed.
Also objects have overheads, which is 16 bytes.
What exactly are these overheads? What are these 24/16 bytes composed of?
Also, do these overheads only exist in Java? How about C, C++ and Python?