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

Overriding make_unique and default_delete #525

Open
equalent opened this issue Feb 6, 2024 · 2 comments
Open

Overriding make_unique and default_delete #525

equalent opened this issue Feb 6, 2024 · 2 comments

Comments

@equalent
Copy link

equalent commented Feb 6, 2024

There is no way to directly override allocation in make_unique and default_delete.

They directly call standard operators, requiring having custom deleters everywhere or editing the source code when integrating EASTL into any project which involves dynamic linking (as overriding new and delete is not supported for DLLs).

Making them use the default allocator is one very simple solution which would at least provide the same allocation as other EASTL types.

@jhopkins-ea
Copy link
Contributor

make_unique is by definition a utillity to create a new-ed object, which will be deleted by a call to delete. (although eastl::make_unique doesn't perfectly mirror the std::make_unique) the standard proposal that added std::make_unique has a good explanation on why users should simply create their own utility function if they want to use their own allocator & deleter. Specifically, see section 3.4.

@equalent
Copy link
Author

equalent commented Feb 7, 2024

Understood. But wouldn't it make more sense to at least make them use the default allocator? This would ensure the entire library has a single default point of allocation, according to the FAQ:
EASTL never uses global new / delete / malloc / free. All allocations are done via user-specified allocators, though a default allocator definition is available.

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

2 participants