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

Alignment ignored in resource_adaptor? #107

Closed
vinniefalco opened this issue Mar 11, 2019 · 4 comments

Comments

@vinniefalco
Copy link
Member

commented Mar 11, 2019

resource_adaptor rebinds the caller's Allocator type to char, which destroys the alignment information. Then in allocate it ignores the alignment parameter. Is this the right thing to do?

@igaztanaga

This comment has been minimized.

Copy link
Member

commented May 4, 2019

You are right. operator new is guaranteed to be aligned to any type without extended alignment attributes, but the char-rebound Allocator type could only guarantee byte alignment. I'll review design alternatives to guarantee aligned allocations.

@vinniefalco

This comment has been minimized.

Copy link
Member Author

commented May 4, 2019

I'm not really happy with the polymorphic allocator / memory resource design but that's not Boost.Container's problem. How do you implement a reference-counted memory resource? Seems there's no way.

I had to roll my own as you can see here:
https://github.com/vinniefalco/BeastLounge/blob/develop/include/boost/beast/_experimental/json/storage.hpp#L34

@igaztanaga

This comment has been minimized.

Copy link
Member

commented May 4, 2019

memory_resource isn't thought for that use case, many would not like to pay for a reference-counted design that they won't use ;-)

@igaztanaga igaztanaga closed this in e23c573 May 5, 2019

@igaztanaga

This comment has been minimized.

Copy link
Member

commented May 5, 2019

Thanks for the bug report!

Lastique added a commit to Lastique/container that referenced this issue May 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.