Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

Out of Memory exception while using ReadLine() to read large text stream repeatedly

Mar 26 2003 10:53 AM
Problem: I have a very large text file, which size is around 156M. my application needs to read through this text file again and again. There are roughly 1.5 millions of lines in this file and each time I read one line via ReadLine(). Here is the problem: when I read this file in 10th time (roughly 15 millions reads), an except occured within the line 'while...'. sReader = new StreamReader(cl.fileStreamName); string ad = ""; while ( (ad = sReader.ReadLine())!= null){ //throw exception 'Out of Memory' //parse the string ad here } sReader.Close(); Envrionment: .NET FrameWork Version 1.0 Windows 2000 Pro Can someone give me a hint? Thank you, Justin

Answers (3)