Skip to content
HeapAllocatorDeinit

HeapAllocatorDeinit

Description

Release every user page and bookkeeping array owned by self, across every size class. The bookkeeping arrays themselves are released back to the kernel directly, then the struct is zeroed so any post-deinit dispatch trips ValidateAllocator on the cleared __magic.

Parameters

Name Direction Description
self in,out HeapAllocator instance, or NULL.

Success

Function returns. Every pointer previously handed out by this heap is invalid; the struct is fully zeroed and cannot be used until re-initialised.

Failure

No action when self is NULL.

Usage example (Cross-references)

Usage examples (Cross-references)
            LogWrite(LOG_MESSAGE_TYPE_FATAL, __func__, __LINE__, StrBegin(&UNPL(m)));                                      \
            StrDeinit(&UNPL(m));                                                                                           \
            HeapAllocatorDeinit(&UNPL(log_alloc));                                                                         \
            Abort();                                                                                                       \
        } while (0)
            LogWrite(LOG_MESSAGE_TYPE_ERROR, __func__, __LINE__, StrBegin(&UNPL(m)));                                      \
            StrDeinit(&UNPL(m));                                                                                           \
            HeapAllocatorDeinit(&UNPL(log_alloc));                                                                         \
        } while (0)
            LogWrite(LOG_MESSAGE_TYPE_INFO, __func__, __LINE__, StrBegin(&UNPL(m)));                                       \
            StrDeinit(&UNPL(m));                                                                                           \
            HeapAllocatorDeinit(&UNPL(log_alloc));                                                                         \
        } while (0)
            LogWrite(LOG_MESSAGE_TYPE_FATAL, __func__, __LINE__, StrBegin(&UNPL(m)));                                      \
            StrDeinit(&UNPL(m));                                                                                           \
            HeapAllocatorDeinit(&UNPL(log_alloc));                                                                         \
            Abort();                                                                                                       \
        } while (0)
            LogWrite(LOG_MESSAGE_TYPE_ERROR, __func__, __LINE__, StrBegin(&UNPL(m)));                                      \
            StrDeinit(&UNPL(m));                                                                                           \
            HeapAllocatorDeinit(&UNPL(log_alloc));                                                                         \
        } while (0)
            LogWrite(LOG_MESSAGE_TYPE_INFO, __func__, __LINE__, StrBegin(&UNPL(m)));                                       \
            StrDeinit(&UNPL(m));                                                                                           \
            HeapAllocatorDeinit(&UNPL(log_alloc));                                                                         \
        } while (0)
    #    define DefaultAllocatorDeinit(ptr) DebugAllocatorDeinit(ptr)
    #else
    #    define DefaultAllocatorDeinit(ptr) HeapAllocatorDeinit(ptr)
    #endif
    
        StrDeinit(&full);
        HeapAllocatorDeinit(&h);
    }
            VecDeinit(&self->freed);
    
        HeapAllocatorDeinit(&self->meta);
        HeapAllocatorDeinit(&self->heap);
        // PageAllocatorDeinit is deliberately NOT called. When
    
        HeapAllocatorDeinit(&self->meta);
        HeapAllocatorDeinit(&self->heap);
        // PageAllocatorDeinit is deliberately NOT called. When
        // force_page_backing is true, allocs were never returned via
    }
    
    void HeapAllocatorDeinit(HeapAllocator *self) {
        if (!self)
            return;
        }
        VecDeinit(&dc);
        HeapAllocatorDeinit(&ha);
    
        if (!ok) {
            pfds   = (plat_pollfd_t *)AllocatorAlloc(&halloc, sizeof(plat_pollfd_t) * count, true);
            if (!pfds) {
                HeapAllocatorDeinit(&halloc);
                LOG_ERROR("SocketPoll: heap allocation for pollfd array failed");
                return -1;
        if (used_heap) {
            AllocatorFree(&halloc, pfds);
            HeapAllocatorDeinit(&halloc);
        }
        return ret;
        }
    
        HeapAllocatorDeinit(&heap);
        return ok;
    }
        if (p)
            AllocatorFree(alloc, p);
        HeapAllocatorDeinit(&heap);
        return ok;
    }
        void *p = AllocatorAlloc(alloc, 0, false);
    
        HeapAllocatorDeinit(&heap);
        return p == NULL;
    }
        if (p)
            AllocatorFree(alloc, p);
        HeapAllocatorDeinit(&heap);
        return ok;
    }
        AllocatorFree(alloc, b);
        AllocatorFree(alloc, c);
        HeapAllocatorDeinit(&heap);
        return ok;
    }
        if (b)
            AllocatorFree(alloc, b);
        HeapAllocatorDeinit(&heap);
        return ok;
    }
        void **ptrs = (void **)AllocatorAlloc(alloc, (size)(N * sizeof(void *)), true);
        if (!ptrs) {
            HeapAllocatorDeinit(&heap);
            return false;
        }
        }
        AllocatorFree(alloc, ptrs);
        HeapAllocatorDeinit(&heap);
        return ok;
    }
                AllocatorFree(alloc, ptrs[i]);
        }
        HeapAllocatorDeinit(&heap);
        return ok;
    }
            ok = ok && (HeapAllocatorXlCount(&heap) == 0);
        }
        HeapAllocatorDeinit(&heap);
        return ok;
    }
        if (p)
            AllocatorFree(alloc, p);
        HeapAllocatorDeinit(&heap);
        return ok;
    }
            AllocatorFree(alloc, grown);
        }
        HeapAllocatorDeinit(&heap);
        return ok;
    }
                AllocatorFree(alloc, grown);
        }
        HeapAllocatorDeinit(&heap);
        return ok;
    }
        AllocatorFree(alloc1, a);
        AllocatorFree(alloc2, b);
        HeapAllocatorDeinit(&h1);
        HeapAllocatorDeinit(&h2);
        return ok;
        AllocatorFree(alloc2, b);
        HeapAllocatorDeinit(&h1);
        HeapAllocatorDeinit(&h2);
        return ok;
    }
        VecDeinit(&aligned_vec);
    
        HeapAllocatorDeinit(&aligned8);
        DefaultAllocatorDeinit(&alloc);
        return result;
        VecDeinit(&aligned_vec);
    
        HeapAllocatorDeinit(&aligned8);
        DefaultAllocatorDeinit(&alloc);
        return result;
    
        VecDeinit(&vec);
        HeapAllocatorDeinit(&alloc);
        return result;
    }
    
        StrDeinit(&out);
        HeapAllocatorDeinit(&scratch);
        if (p1)
            AllocatorFree(adbg, p1);
    
        StrDeinit(&out);
        HeapAllocatorDeinit(&scratch);
        if (p)
            AllocatorFree(adbg, p);
        VecDeinit(&src);
        VecDeinit(&dst);
        HeapAllocatorDeinit(&local_heap);
        return result;
    }
    
        StrDeinit(&out);
        HeapAllocatorDeinit(&scratch);
        if (p)
            AllocatorFree(adbg, p);
        StrDeinit(&ns);
        StrDeinit(&out);
        HeapAllocatorDeinit(&scratch);
        if (p)
            AllocatorFree(adbg, p);
    
        FloatDeinit(&v);
        HeapAllocatorDeinit(&fa);
        DebugAllocatorDeinit(&dbg);
        return ok;
    
        FloatDeinit(&v);
        HeapAllocatorDeinit(&fa);
        DebugAllocatorDeinit(&dbg);
        return ok;
    
        FloatDeinit(&v);
        HeapAllocatorDeinit(&fa);
        DebugAllocatorDeinit(&dbg);
        return ok;
    
        FloatDeinit(&v);
        HeapAllocatorDeinit(&fa);
        DebugAllocatorDeinit(&dbg);
        return ok;
        DebugAllocatorDeinit(&dbg);
        StrDeinit(&s);
        HeapAllocatorDeinit(&va);
        return ok;
    }
        DebugAllocatorDeinit(&dbg);
        IntDeinit(&v);
        HeapAllocatorDeinit(&va);
        return ok;
    }
        DebugAllocatorDeinit(&dbg);
        FloatDeinit(&v);
        HeapAllocatorDeinit(&va);
        return ok;
    }
        DebugAllocatorDeinit(&dbg);
        BitVecDeinit(&v);
        HeapAllocatorDeinit(&va);
        return ok;
    }
        DebugAllocatorDeinit(&dbg);
        StrDeinit(&s);
        HeapAllocatorDeinit(&sa);
        return ok;
    }
        DebugAllocatorDeinit(&dbg);
        FloatDeinit(&f);
        HeapAllocatorDeinit(&fa);
        return ok;
    }
    
        GraphDeinit(&graph);
        HeapAllocatorDeinit(&alloc);
        return result;
    }
    
        VecDeinit(&vec);
        HeapAllocatorDeinit(&heap);
        return result;
    }
    
        VecDeinit(&vec);
        HeapAllocatorDeinit(&heap);
        return result;
    }
        VecDeinit(&test_vec);
    
        HeapAllocatorDeinit(&aligned4);
        HeapAllocatorDeinit(&aligned16);
        return result;
    
        HeapAllocatorDeinit(&aligned4);
        HeapAllocatorDeinit(&aligned16);
        return result;
    }
        VecDeinit(&vec);
    
        HeapAllocatorDeinit(&aligned8);
        return result;
    }
        VecDeinit(&vec_h);
    
        HeapAllocatorDeinit(&h_default);
        HeapAllocatorDeinit(&h8);
        HeapAllocatorDeinit(&h16);
    
        HeapAllocatorDeinit(&h_default);
        HeapAllocatorDeinit(&h8);
        HeapAllocatorDeinit(&h16);
        HeapAllocatorDeinit(&h32);
        HeapAllocatorDeinit(&h_default);
        HeapAllocatorDeinit(&h8);
        HeapAllocatorDeinit(&h16);
        HeapAllocatorDeinit(&h32);
        HeapAllocatorDeinit(&h64);
        HeapAllocatorDeinit(&h8);
        HeapAllocatorDeinit(&h16);
        HeapAllocatorDeinit(&h32);
        HeapAllocatorDeinit(&h64);
        return result;
        HeapAllocatorDeinit(&h16);
        HeapAllocatorDeinit(&h32);
        HeapAllocatorDeinit(&h64);
        return result;
    }
        void *p = AllocatorAlloc(alloc, 64, false);
        if (!p) {
            HeapAllocatorDeinit(&heap);
            return false;
        }
    
        AllocatorFree(alloc, p);
        HeapAllocatorDeinit(&heap);
        return ok;
    }
        GraphDeinit(&graph_h);
    
        HeapAllocatorDeinit(&aligned_64);
        HeapAllocatorDeinit(&aligned_32);
        HeapAllocatorDeinit(&aligned_16);
    
        HeapAllocatorDeinit(&aligned_64);
        HeapAllocatorDeinit(&aligned_32);
        HeapAllocatorDeinit(&aligned_16);
        HeapAllocatorDeinit(&aligned_8);
        HeapAllocatorDeinit(&aligned_64);
        HeapAllocatorDeinit(&aligned_32);
        HeapAllocatorDeinit(&aligned_16);
        HeapAllocatorDeinit(&aligned_8);
        DefaultAllocatorDeinit(&alloc);
        HeapAllocatorDeinit(&aligned_32);
        HeapAllocatorDeinit(&aligned_16);
        HeapAllocatorDeinit(&aligned_8);
        DefaultAllocatorDeinit(&alloc);
        return result;
Last updated on