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

RawVec should round capacity to jemalloc bucket size #40058

Closed
hsivonen opened this issue Feb 23, 2017 · 2 comments
Closed

RawVec should round capacity to jemalloc bucket size #40058

hsivonen opened this issue Feb 23, 2017 · 2 comments

Comments

@hsivonen
Copy link
Member

By inspection of source code, it seems that RawVec is unaware of jemalloc bucket sizes. This is unfortunate, because it's wasteful to reallocate when the required capacity would fit within the current jemalloc allocation but RawVec just doesn't know.

As far as abstraction leakage goes, it would be better to let the leakage stop at RawVec than to have higher-level code try to second-guess RawVec with assumptions about the underlying allocator.

I suggest that the allocator crate provide a rounding function for rounding up to the largest allocation size that would consume as much space in the underlying allocator as the requested size and RawVec use it to round up capacity. For jemalloc, the rounding function would round to the jemalloc bucket size.

@nagisa
Copy link
Member

nagisa commented Feb 23, 2017

Duplicate of #29931 and #32075

@Mark-Simulacrum
Copy link
Member

Closing in favor of #29931.

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

3 participants