从存储读取 OutOfMemoryException
OutOfMemoryException reading from storage
我只是在玩 Windows Phone 开发和使用存储。
在存储上,我有一个 10MB 的文件,里面有 NUL。现在,我想测试从存储中读取这个文件需要多长时间。
for (int i = 0; i < 10; i++)
{
before = DateTime.Now;
input = await FileIO.ReadLinesAsync(resultfile);
after = DateTime.Now;
}
这只是一个片段,但这让我出现了以下错误:
System.OutOfMemoryException" in mscorlib.ni.dll
WinRT-Informationen: Not enough storage is available to complete this operation
发生在i == 4
时。如果要读取的文件只有 1MB,则不会出现错误。
谁能给我解释一下这是怎么回事?
如果我调用 input.clear() 或 GC.collect() 它会起作用!
我只是在玩 Windows Phone 开发和使用存储。
在存储上,我有一个 10MB 的文件,里面有 NUL。现在,我想测试从存储中读取这个文件需要多长时间。
for (int i = 0; i < 10; i++)
{
before = DateTime.Now;
input = await FileIO.ReadLinesAsync(resultfile);
after = DateTime.Now;
}
这只是一个片段,但这让我出现了以下错误:
System.OutOfMemoryException" in mscorlib.ni.dll WinRT-Informationen: Not enough storage is available to complete this operation
发生在i == 4
时。如果要读取的文件只有 1MB,则不会出现错误。
谁能给我解释一下这是怎么回事?
如果我调用 input.clear() 或 GC.collect() 它会起作用!