Ejemplo n.º 1
0
 void OnEnable()
 {
     CerasSerializer.ClearGenericCaches();
     Application.runInBackground = true;
     SetupSerializer();
     StartStreaming();
 }
Ejemplo n.º 2
0
 void OnDisable()
 {
     // According to
     // https://stackoverflow.com/questions/24312265/should-a-udpclient-be-disposed-of
     // You should use .Close() rather than .Dispose()
     _socket.Close();
     CerasSerializer.ClearGenericCaches();
     DataPool.ReceivedFrame.Clear();
     DataPool.SendFrame.Clear();
 }
Ejemplo n.º 3
0
        public void ClearGenericCaches()
        {
            var ceras = new CerasSerializer();

            var list = new List <Cat>();

            for (int i = 0; i < 1000; i++)
            {
                list.Add(new Cat());
            }

            var data  = ceras.Serialize(list);
            var clone = ceras.Deserialize <List <Cat> >(data);

            var capacityBefore = ObjectCache.RefProxyPool <Cat> .GetPoolCapacity();

            Assert.True(capacityBefore > 500);

            CerasSerializer.ClearGenericCaches();

            var capacityAfter = ObjectCache.RefProxyPool <Cat> .GetPoolCapacity();

            Assert.True(capacityAfter < capacityBefore);
        }