in reply to Memory issue while opening and reading a file

There is no fault in script.

Here it is problem

@records = <TEST>;

It is problem with memory, because your RAM size is less than your file size.