예제 #1
0
        public static void Main(string[] args)
        {
            var actor = new ListActor();

            for (int count = 0; count < 1000; count++)
            {
                var messageRegion = RegionAllocator.AllocateRegion(2000000);
                var oneMsgList    = new RegionList <Item>(messageRegion);
                for (int j = 0; j < 2000000 / 32; j++)
                {
                    var item = new Item(messageRegion, 1, 1);
                    oneMsgList.Add(item);
                }

                actor.OnRecv(messageRegion, oneMsgList);
            }
        }
예제 #2
0
        public void OnRecv(Region messageRegion, RegionList <Item> list)
        {
            var newItemList = new ItemList(_actorRegion, list);

            _list.Add(newItemList);
            _recvCount++;

            if (_recvCount % 5 == 0)
            {
                try
                {
                    var itemList = _list.RemoveAtAndGet(_list.Count - 3);
                    RegionAllocator.FreeRegion(itemList.List.region);
                }
                catch (Exception)
                {
                }
            }
        }
예제 #3
0
 public ListActor()
 {
     _actorRegion = RegionAllocator.AllocateRegion(64000);
     _list        = new RegionList <ItemList>(_actorRegion);
 }
예제 #4
0
 public ItemList(Region region, RegionList <Item> list)
 {
     _list = list;
 }