Fixed memory reallocation problem for large files