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
Hi, hurley:
在heap.c中,分割内存块的函数split_chunk(header_t *chunk, uint32_t len),其中len是期望获得的chunk的长度,那么分割出来的newchunk的长度不应该是 newchunk = chunk + len吗?
split_chunk(header_t *chunk, uint32_t len)
len
newchunk = chunk + len
mm/heap.c line 137 function split_chunk() if (chunk->length - len > sizeof (header_t)) { - header_t *newchunk = (header_t *)((uint32_t)chunk + chunk->length); + header_t *newchunk = (header_t *)((uint32_t)chunk + len); ... ... }
mm/heap.c line 137 function split_chunk()
if (chunk->length - len > sizeof (header_t)) { - header_t *newchunk = (header_t *)((uint32_t)chunk + chunk->length); + header_t *newchunk = (header_t *)((uint32_t)chunk + len); ... ... }
不知道我的想法有没有错,望解答 :)
The text was updated successfully, but these errors were encountered:
嗯,看起来是有点问题,你可以提个pull request的。这里的代码来自James的文档,我还真没有写测试。很抱歉对你造成了困扰,现在的hurlex-II使用链表的封装实现这块代码,相对来说可读性好一些: https://github.com/hurley25/Hurlex-II/blob/master/mm/slob.c
Sorry, something went wrong.
好的,谢谢你的答复以及文档,受益良多。 待会我提个PR。
No branches or pull requests
Hi, hurley:
在heap.c中,分割内存块的函数
split_chunk(header_t *chunk, uint32_t len)
,其中len
是期望获得的chunk的长度,那么分割出来的newchunk的长度不应该是newchunk = chunk + len
吗?不知道我的想法有没有错,望解答 :)
The text was updated successfully, but these errors were encountered: