We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
初始化内存池时,此时内存池作为一个大的空闲块,其尾部也应该有指针指向首地址,此次没有相应操作 像这样: *(mp_chunk**)((char*)ck + ck->size - MP_CHUNK_POINTER) = ck;
*(mp_chunk**)((char*)ck + ck->size - MP_CHUNK_POINTER) = ck;
#define MP_INIT_MEMORY_STRUCT(mm, mempool_sz) \ do { \ mm->mempool_size = mempool_sz; \ mm->alloc_mem = 0; \ mm->alloc_prog_mem = 0; \ mm->free_list = (_MP_Chunk*) mm->start; \ mm->free_list->is_free = 1; \ mm->free_list->alloc_mem = mempool_sz; \ mm->free_list->prev = NULL; \ mm->free_list->next = NULL; \ mm->alloc_list = NULL; \ } while (0)
The text was updated successfully, but these errors were encountered:
不是必要的,该块要么一直处于free链的尾部,merge free的时候不会有后面来的查找;要么被alloc出去后这里自然就被写上地址信息了
Sorry, something went wrong.
No branches or pull requests
初始化内存池时,此时内存池作为一个大的空闲块,其尾部也应该有指针指向首地址,此次没有相应操作
像这样:
*(mp_chunk**)((char*)ck + ck->size - MP_CHUNK_POINTER) = ck;
The text was updated successfully, but these errors were encountered: