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
split_chunk()函数缺少了 next_chunck->next->prev = next_chunck; 如果不这样的话 newchunk->next->pre永远指向 chunk 而不是 newchunk。 是否应该添加这样的代码
if(newchunck->next) { newchunck->next->prev = newchunck; }
The text was updated successfully, but these errors were encountered:
newchunk->next->pre并没有指向chunk,而是默认值NULL,只有已经被申请的内存块的pre指针才有意义(:smile:我瞎猜的,欢迎大佬批评指正
Sorry, something went wrong.
newchunk->next->pre并没有指向chunk,而是默认值NULL,只有已经被申请的内存块的pre指针才有意义(😄我瞎猜的,欢迎大佬批评指正
1->2 考虑这样一种情况,在某次分配、合并结束后有上面这两块内存,1号没被分配2号被分配了这时候2指向1。
1->3->2
这时候我又从1中分配了了一块内存这时候newchunk就是3,3的next->pre如果不更改的话就会还指向1也就是2的pre还是1不是3。 那么如果3被分配出去了。1和2回收时不管3回收没都会被glue函数回收掉。
No branches or pull requests
split_chunk()函数缺少了
next_chunck->next->prev = next_chunck;
如果不这样的话 newchunk->next->pre永远指向 chunk 而不是 newchunk。
是否应该添加这样的代码
The text was updated successfully, but these errors were encountered: