Exemplo n.º 1
0
        /// <summary>
        /// 删除没有使用的
        /// </summary>
        public void UnloadUnused()
        {
            this.sweepMark++;
            //标记
            foreach (var item in abDict)
            {
                ABProxy abProxy = item.Value;
                abProxy.Mark(this.sweepMark);
            }


            //清扫
            List <string> list = null;

            foreach (var item in abDict)
            {
                ABProxy abProxy = item.Value;
                if (abProxy.sweepMark != sweepMark)
                {
                    if (list == null)
                    {
                        list = new List <string>();
                    }

                    list.Add(item.Key);
                }
            }
            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    string  abName = list[i];
                    ABProxy ab     = abDict[abName];
                    ab.Dispose();
                    abDict.Remove(list[i]);
                }
            }
        }