- C# code
using (MemoryStream ms = new MemoryStream()) { using (StreamWriter writer = new StreamWriter(ms)) { int count = 1024 * 1024 * 40; char[] str = new char[count]; while (count-- > 0) str[count] = '*'; writer.Write(str); writer.Flush(); } }
今天测试向MemoryStream中写入大数据,结果发现在silverlight中内存不会被释放,达200多MB,但在asp.net中可以。why?