added function which computes memory usage inside heap and has the pointer as an argument.