Skip to content
New issue

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

Seems wasting 8 bytes per chunk? Didnt get the point of returning &found->next #11

Open
flankerhqd opened this issue Feb 10, 2020 · 1 comment

Comments

@flankerhqd
Copy link

flankerhqd commented Feb 10, 2020

Hi:

Nice job!

Got a bit question though. What’s the point of returning &found->next to user in malloc? The whole chunk size is still “sizeof(node_t) + size + sizeof(footer)”, which means although user get 8 bytes in advance, they still didn’t utilize the whole chunk (access finishes at size - 8). Why not just return ‘head + szieof(node_t)’, which simplifies the trick?

@flankerhqd flankerhqd changed the title Seems wasting 8 bytes per chunk? Didnt get the point of Seems wasting 8 bytes per chunk? Didnt get the point of returning &found->next Feb 10, 2020
@scuec-weiqiang
Copy link

I think it's a mistake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants