add memory usage debugging