Hi Naveen -
Can you provide more information as such,
(a) On what operating system you are running this code?
(b)How these input records are given to program to read/parse?
(c) Are you getting the out of memory message immediately upon executing the program or after certain process that happened and seeing it?
Further more information would really help to provide valuable feed backs to help.