Beispiel #1
0
        internal static void FreeMemory(UIntPtr startAddr, UIntPtr size)
        {
#if SINGULARITY_KERNEL
            DebugStub.Assert(Sing_MemoryManager.IsPageAligned(size));
            Sing_MemoryManager.KernelFree(
                startAddr, Sing_MemoryManager.PagesFromBytes(size),
                Process.kernelProcess);
#elif SINGULARITY_PROCESS
            VTable.Assert((size & PageTable.PageMask) == 0);
            PageTableService.Free(startAddr, size);
#endif
        }
        internal unsafe UIntPtr FreeAllPages()
        {
            // We assume that external code has insured thread safety.
            freeList = null;

            for (HandlePage *next; pages != null; pages = next)
            {
                next = pages->next;

                MemoryManager.KernelFree((UIntPtr)pages, 1, process);
            }

            return((UIntPtr)pageCount * MemoryManager.PageSize);
        }