本文介绍了字符串内存分配(需要紧急帮助)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在读一个大到10-20 MB的大文件,一行在1行以下



string [] lines = System.IO.File.ReadAllLines(file_name);



我将每行保存到数据库,并处理连接。



现在当我再次执行此操作时,Windows应用程序因内存不足而崩溃。



我在第一次读操作时看到内存增加,并且在操作完成时没有释放。



如何释放分配给该字符串的内存。

谢谢,

Shreyas

解决方案



Hi,

I am reading a large file upto 10-20 MB in a string in 1 go in below line

string[] lines = System.IO.File.ReadAllLines(file_name);

I save each line to database , and dispose the connection.

Now when i again do this operation , the windows app crashes with out of memory exception.

I see during first read operation memory increases and is not freed when operation completes.

How can i free the memory allocated to this string.
Thanks,
Shreyas

解决方案



这篇关于字符串内存分配(需要紧急帮助)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 09:10
查看更多