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

Fix using pmr::polymorphic_allocator in pre-main #232

Merged
merged 1 commit into from
Dec 11, 2022

Conversation

georgthegreat
Copy link
Contributor

@georgthegreat georgthegreat commented Oct 1, 2022

A similar problems for the above (i. e. non-atomic) branch was addressed in #148, yet the default C++11 branch causes segfault with the following stacktrace:

(gdb) bt
#0  0x000000000e1c3d28 in boost::container::pmr::memory_resource::allocate (this=0x0, bytes=92, alignment=4)
    at boost/container/include/boost/container/pmr/memory_resource.hpp:48
#1  0x000000000e2e9e59 in boost::container::pmr::polymorphic_allocator<float>::allocate (this=0x7fffffffd148, n=23)
    at boost/container/include/boost/container/pmr/polymorphic_allocator.hpp:92
#2  0x000000000e2e9cdd in std::__y1::allocator_traits<boost::container::pmr::polymorphic_allocator<float> >::allocate (__a=..., __n=23)
    at libcxx/include/__memory/allocator_traits.h:262
#3  0x000000000e2e9b13 in std::__y1::vector<float, boost::container::pmr::polymorphic_allocator<float> >::__vallocate (this=0x7fffffffd130, __n=23)
    at libcxx/include/vector:958
#4  0x000000000e33c591 in std::__y1::vector<float, boost::container::pmr::polymorphic_allocator<float> >::vector (this=0x7fffffffd130, __n=23)
    at libcxx/include/vector:1106

A similar problems for the above (i. e. non-atomic) branch was addressed in boostorg#148, yet the default C++11 branch causes segault with the following stacktrace:

```
(gdb) bt
#0  0x000000000e1c3d28 in boost::container::pmr::memory_resource::allocate (this=0x0, bytes=92, alignment=4)
    at boost/container/include/boost/container/pmr/memory_resource.hpp:48
boostorg#1  0x000000000e2e9e59 in boost::container::pmr::polymorphic_allocator<float>::allocate (this=0x7fffffffd148, n=23)
    at boost/container/include/boost/container/pmr/polymorphic_allocator.hpp:92
boostorg#2  0x000000000e2e9cdd in std::__y1::allocator_traits<boost::container::pmr::polymorphic_allocator<float> >::allocate (__a=..., __n=23)
    at libcxx/include/__memory/allocator_traits.h:262
boostorg#3  0x000000000e2e9b13 in std::__y1::vector<float, boost::container::pmr::polymorphic_allocator<float> >::__vallocate (this=0x7fffffffd130, __n=23)
    at libcxx/include/vector:958
boostorg#4  0x000000000e33c591 in std::__y1::vector<float, boost::container::pmr::polymorphic_allocator<float> >::vector (this=0x7fffffffd130, __n=23)
    at libcxx/include/vector:1106
```
@igaztanaga igaztanaga merged commit 5e76b84 into boostorg:develop Dec 11, 2022
@igaztanaga
Copy link
Member

Many thanks for the patch!

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