C??????????????
???????????? ???????[ 2012/9/29 15:31:32 ] ????????
????????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????????????????С?????????е????顣
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11