C#非常大的字符串操作(内存不足异常) [英] C# Very Large String Manipulation (Out of Memory Exception)
本文介绍了C#非常大的字符串操作(内存不足异常)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从磁盘读取1GB的原始文本文件, > string contents = File.ReadAllText(path)
抛出内存异常(不出所料) p>
最好的方法是什么?
解决方案
也许看看使用内存映射文件
I have a need to read in a 1gb raw text file from disk to ram to do some string manipulation in C#.
string contents = File.ReadAllText(path)
is throwing out of memory exceptions (unsurprisingly)
What is the best way to go about this?
解决方案
Possibly also look at using a memory-mapped file
这篇关于C#非常大的字符串操作(内存不足异常)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文