public void SyncDiscardedPages(H1LinearAllocationType allocType, UInt64 fenceId)
        {
            Int32 allocatorTypeIndex = Convert.ToInt32(allocType);

            foreach (Tuple <UInt64, H1GpuResAllocPage> fencedAllocPage in m_RetiredPages[allocatorTypeIndex])
            {
                UInt64 allocPageFenceId = fencedAllocPage.Item1;
                if (allocPageFenceId < fenceId) // looping alloc page in retired pages, check whether current alloc page is allowed to release
                {
                    H1GpuResAllocPage newlyAvailablePage = fencedAllocPage.Item2;
                    m_AvailablePages[allocatorTypeIndex].Enqueue(newlyAvailablePage);
                    m_RetiredPages[allocatorTypeIndex].Dequeue();
                }
            }
        }
        public H1GpuResAllocPage RequestPage(H1LinearAllocationType allocType)
        {
            // check whether available page exists
            Queue <H1GpuResAllocPage> availablePageQueue = m_AvailablePages[Convert.ToInt32(allocType)];

            if (availablePageQueue.Count > 0)
            {
                return(availablePageQueue.Dequeue());
            }

            // crate new pages
            H1GpuResAllocPage newPage = null;

            //CreateAllocPage(allocType, ref newPage);
            //if (newPage == null) // failed to create alloc page
            return(null);

            m_PagePool[Convert.ToInt32(allocType)].Add(newPage);
            return(newPage);
        }