Exemple #1
0
        private bool TryAllocateAtLastPage(int id, int size, int a, out SharedMemoryBlock result)
        {
            var offset = _pages[_pages.Count - 1].Allocator.TryAllocate(id, size, a);

            if (offset != 0)
            {
                result = new SharedMemoryBlock(this, _pages.Count - 1, offset, size);
                return(true);
            }
            result = null;
            return(false);
        }
Exemple #2
0
        //Throw if inconsistent size
        private bool FindAllocation(Page p, int id, int size, out SharedMemoryBlock result)
        {
            var offset = p.Allocator.TryFindAllocated(id, size);

            if (offset != 0)
            {
                result = new SharedMemoryBlock(this, _pages.Count - 1, offset, size);
                return(true);
            }
            result = null;
            return(false);
        }