How to calculate bytes of memory in an array?