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

Turns the mirrored module into an allocator #33

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Turns the mirrored module into an allocator #33

wants to merge 6 commits into from

Conversation

gnzlbg
Copy link
Owner

@gnzlbg gnzlbg commented Mar 11, 2018

The allocator is currently trivial. It never frees any memory. Instead it caches the freed allocations into a HashMap<size, Vec<*mut ptr>>. When a new allocation is requested, it tries to reuse a previously-freed allocation from the cache.

A slice_deque::release() function is provided that frees all the currently unused memory.

@gnzlbg
Copy link
Owner Author

gnzlbg commented Mar 29, 2018

@bill-myers what do you think of this? It basically caches the smallest allocation in a vector, and the rest in a HashMap, and does so in thread-local caches.

@Boscop
Copy link

Boscop commented Mar 11, 2020

@gnzlbg Wouldn't it be faster to use fnv as the hasher for the HashMap? I'm no expert but fnv is usually recommended for small/integer keys.

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

Successfully merging this pull request may close these issues.

2 participants