Example #1
0
        public IntPtr Localloc(uint guardPos, uint size)
        {
            var node = new LocallocNode
            {
                GuardPos = guardPos,
                Memory   = Marshal.AllocHGlobal((int)size)
            };
            var insert = localPool;

            while (insert != null)
            {
                if (insert.Next == null || insert.Next.GuardPos < guardPos)
                {
                    break;
                }
                insert = insert.Next;
            }
            if (insert == null)
            {
                localPool = node;
            }
            else
            {
                node.Next   = insert.Next;
                insert.Next = node;
            }
            return(node.Memory);
        }
Example #2
0
 private void CheckFreeLocalloc()
 {
     while (localPool != null && localPool.GuardPos > topPos)
     {
         localPool = localPool.Free();
     }
 }
Example #3
0
 private void CheckFreeLocalloc()
 {
     while (this.localPool != null && this.localPool.GuardPos > this.topPos)
     {
         this.localPool = this.localPool.Free();
     }
 }
Example #4
0
 public void FreeAllLocalloc()
 {
     var node = localPool;
     while(node != null)
         node = node.Free();
     localPool = null;
 }
Example #5
0
        public void FreeAllLocalloc()
        {
            LocallocNode node = this.localPool;

            while (node != null)
            {
                node = node.Free();
            }
            this.localPool = null;
        }