heap_allocator icon indicating copy to clipboard operation
heap_allocator copied to clipboard

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

Open flankerhqd opened this issue 5 years ago • 1 comments

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 avatar Feb 10 '20 09:02 flankerhqd