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

default_user_allocator_malloc_free in Simple_object_pool #1100

Open
mglisse opened this issue Jul 2, 2024 · 0 comments
Open

default_user_allocator_malloc_free in Simple_object_pool #1100

mglisse opened this issue Jul 2, 2024 · 0 comments

Comments

@mglisse
Copy link
Member

mglisse commented Jul 2, 2024

class Simple_object_pool : protected boost::pool<boost::default_user_allocator_malloc_free> {

In Simple_object_pool, I specified default_user_allocator_malloc_free because it was slightly faster than the default. Now that we are increasing its use, I am worried that this choice may cause problems, and we should investigate what happens for out-of-memory. Supposedly, the default is based on new/delete and should throw an exception, whereas the malloc version may crash. In that case, it may be safer (particularly for the Python module) to go back to the default.

Other things to look at around there:

  • Pool_cell_constructor: just add to Simple_object_pool the functions we are missing to use it directly? (probably not the questionable operator= and swap though)
  • New_cell_constructor: just std::allocator?
  • Can we use simple_segregated_storage instead of pool in Simple_object_pool? (probably not worth it, I just mention it as a way to ensure we don't use the questionable parts of boost::pool)
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

1 participant