Calculating the total memory used by your application