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

Investigate making the free list doubly linked #27

Open
fitzgen opened this issue Feb 23, 2018 · 3 comments
Open

Investigate making the free list doubly linked #27

fitzgen opened this issue Feb 23, 2018 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed mentored

Comments

@fitzgen
Copy link
Member

fitzgen commented Feb 23, 2018

Summary

Investigate rounding up allocations to at least two words, and making the free list doubly linked.

Motivation

This could simplify code, maybe shrink code size, and lessen fragmentation.

Details

  • We could remove deferred consolidation of cells. Simplifying code and hopefully also shrinking code size.

  • We could always consolidate a free cell with both of its neighbors, if they are also free. Right now we can only do one or the other because the free list is singly linked, and doesn't afford these kinds of manipulations in O(1) time.

  • Downside is that heap allocations of size < 2 words get rounded up. I think this is probably an OK choice.

  • We would make FreeCell have another link prev_free_raw that is the previous free list pointer.

  • Anywhere we insert into or remove from the free list, we would need to make sure that the new link is kept valid.

Happy to mentor anyone who wants to try their hand at this!

@fitzgen fitzgen added enhancement New feature or request help wanted Extra attention is needed mentored labels Feb 23, 2018
@fitzgen fitzgen changed the title Investigate rounding up allocations to at least two words, and making the free list doubly linked Investigate making the free list doubly linked Feb 23, 2018
@manaskarekar
Copy link

manaskarekar commented Mar 6, 2018

I would like to give this a shot! I've started looking through the code.

@fitzgen
Copy link
Member Author

fitzgen commented Mar 6, 2018

Great! Let me know if you run into any questions or anything. See also http://fitzgeraldnick.com/2018/02/09/wee-alloc.html for an overview of the design.

Note that #32 just changed things up a little bit, but the design largely remains the same.

@manaskarekar
Copy link

Hey @fitzgen sorry about the hiatus. I was thinking about jumping into this again, but just wanted to check if there are any updates to keep in mind?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed mentored
Projects
None yet
Development

No branches or pull requests

2 participants