estimate memory usage