????????C??????????????????????????????????????????????????????????????????棬?????????????????????????????????????Ч?????????????????е???????????????????????????棬??????????????????????????棬??????????????????????????????????

?????????????ò???ж???????????????Щ?????????棬???????????С????飬????????????????????й????

????????????????????????????????????????д?????????????????????????????????????????????????????????????????????????

????????????????

??????????С?size???μ??????

pool_t _pool_new_heap(int size);

??????????????з????С?size?????????Щ???????????????????????????

void *pool_malloc(pool_t?? int size);

??????????С??????????????????????С???

int pool_size(pool_t p);

???????????????????????汻???????????????????

void pool_free(pool_t p);

???????????????Щ????????Щ??????????

?????????????

struct pheap
{
    void *block;
    int size?? used;
};

?????y?????????????????????????

????1??block ?????????malloc??????????????

????2??size ???block?????????????С??

????3??used ???????????????????????????????????????????????????????????????????????used???????涼?????????????з????????

struct pfree
{
    pool_cleanup_t f;
    void *arg;
    struct pheap *heap;
    struct pfree *next;
};
typedef void (*pool_cleanup_t)(void *arg);

?????????????????????????????е??????????????????????飬???????????????????struct pheap???????????struct pfree????????????????????????????漸???????

????1?????????????????struct pfree *next????????????????????????

????2????????????????????????????????????????飬????????pool_cleanup_t f??void *arg???????????????????

????3??pheap??????????????????????????飬?????????

typedef struct pool_struct
{
    int size;
    struct pfree *cleanup;
    struct pfree *cleanup_tail;
    struct pheap *heap;
} _pool?? *pool_t;

???????е?????????£?

????heap?????????????????????飬??????????????????????????μ????顣

????cleanup??cleanup_tail?????????????β?????

????size????????????????С?????????е????顣