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

Add transfer function #828

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

Add transfer function #828

wants to merge 6 commits into from

Conversation

davidbeckingsale
Copy link
Member

No description provided.

@davidbeckingsale
Copy link
Member Author

cc @MrBurmark

{
auto alloc_record = findAllocationRecord(ptr);

if (!(alloc_record->strategy->treatAsPassthrough() && to.getAllocationStrategy()->treatAsPassthrough())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this does a direct transfer when the underlying allocators are the same, but moves when they are different? Wouldn't this allow a direct transfer between named allocators built on different base allocators? Should this take a resource to use for the copy?

Copy link
Member

@MrBurmark MrBurmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable as a start.
I have a couple of questions about certain cases. I don't remember all of the constraints on this so the implementation can remain simple.
Should there be a special case for transferring to and from the same allocator?
What about transferring from a named allocator to the underlying allocator and vice-versa?
Does this mess up the stats/counters?

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.

None yet

2 participants