Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
out-of-memory exception in FileStream
I'm fairly new to C# and am perplexed. Executing the following against a file of 641,763,107 bytes, I get an out-of-memory exception.
FileStream dFile = new FileStream(iFile, FileMode.Open, FileAccess.Read);
BinaryReader binReader = new BinaryReader(dFile);
int iLgth = (int)dFile.Length;
byte dBytes = new byte[iLgth];
dBytes = binReader.ReadBytes(iLgth);
dFile = null;
At the time of execution, the system has 1 1/2gig of memory available. Can anyone help me or explain this error?
0 · ·