implement function to get memory usage