2013年4月17日
摘要: 使用WeakReference 来释放那些长时间在内存中无用的大对象测试代码:View Code using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Runtime.Serialization.Formatters.Binary;namespace WeakReferenceTestSample{ public class SomeBigClass : List<string> { public So... 阅读全文
posted @ 2013-04-17 10:40 武胜-阿伟 阅读(385) 评论(0) 推荐(0) 编辑
摘要: this may not be accurate but its close enough for melong size =0;object o =newobject();using (Stream s =newMemoryStream()){BinaryFormatter formatter =newBinaryFormatter(); formatter.Serialize(s, o); size = s.Length;}private long ObjectSize(object o) { long size = 0; //object o = new object(); ... 阅读全文
posted @ 2013-04-17 10:36 武胜-阿伟 阅读(234) 评论(0) 推荐(0) 编辑