adding memory usage code