Added a function for measuring the size of a dynamic array