Improved handling of internal memory usage