public void ReturnAllocation(MemoryAllocation finishedWith)
        {
            //put back into pool
            _allocationPool.Enqueue(finishedWith);
            return;

            int count = _inputBuffer.Count();

            if (count <= numberOfBlockInPool / 10)
            {
                return;
            }

            //Try to keep in order
            List <MemoryAllocation> itemsToReAdd = new List <MemoryAllocation>();

            for (int i = 0; i < count; i++)
            {
                MemoryAllocation dequeuedItem;
                if (_inputBuffer.TryDequeue(out dequeuedItem))
                {
                    itemsToReAdd.Add(dequeuedItem);
                }
            }
            foreach (var memoryAllocation in itemsToReAdd.OrderBy(o => o.Offset))
            {
                _allocationPool.Enqueue(memoryAllocation);
            }
        }
        public EventCaller GetEventAllocation(MessageType messageType, int length)
        {
            MemoryAllocation allocation = _haywireBridge._memoryManagmentFactory.GetAllocation(length);

            return(new EventCaller {
                MessageLength = length, MessageType = (int)messageType, OffsetPosition = allocation.Offset, MemoryAllocationLength = allocation.Lenght
            });
        }