Ejemplo n.º 1
0
        private void add_to_free_list(malloc_meta *new_)
        {
            malloc_meta **list_head = &List_heads[order(GET_SIZE(new_)) - MIN_SHIFT];

            SET_FREE(new_);
            new_->Data.Free.Next = *list_head;
            new_->Data.Free.Prev = null;
            if ((*list_head) != null)
            {
                (*list_head)->Data.Free.Prev = new_;
            }
            *list_head = new_;
        }
Ejemplo n.º 2
0
        void add_to_free_list(malloc_meta *new_)
        {
            malloc_meta **list_head = &list_heads[order(GET_SIZE(new_)) - MIN_SHIFT];;

            SET_FREE(new_);
            new_->data.free.next = *list_head;
            new_->data.free.prev = null;
            if ((*list_head) != null)
            {
                (*list_head)->data.free.prev = new_;
            }
            *list_head = new_;
        }
Ejemplo n.º 3
0
        private void remove_from_free_list(malloc_meta *to_del)
        {
            malloc_meta **list_head = &List_heads[order(GET_SIZE(to_del)) - MIN_SHIFT];

            SET_INUSE(to_del);
            if (*list_head == to_del)
            {
                *list_head = to_del->Data.Free.Next;
            }
            if (to_del->Data.Free.Next != null)
            {
                to_del->Data.Free.Next->Data.Free.Prev = to_del->Data.Free.Prev;
            }
            if (to_del->Data.Free.Prev != null)
            {
                to_del->Data.Free.Prev->Data.Free.Next = to_del->Data.Free.Next;
            }
        }