Skip to content

Turns the mirrored module into an allocator - #33

Open
gnzlbg wants to merge 6 commits into
masterfrom
alloc
Open

Turns the mirrored module into an allocator#33
gnzlbg wants to merge 6 commits into
masterfrom
alloc

Conversation

@gnzlbg

@gnzlbg gnzlbg commented Mar 11, 2018

Copy link
Copy Markdown
Owner

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

gnzlbg commented Mar 29, 2018

Copy link
Copy Markdown
Owner Author

@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

Boscop commented Mar 11, 2020

Copy link
Copy Markdown

@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