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

64-byte alignment causes assertion in rbtree_best_fit #50

Closed
tamboril opened this issue Mar 1, 2018 · 1 comment
Closed

64-byte alignment causes assertion in rbtree_best_fit #50

tamboril opened this issue Mar 1, 2018 · 1 comment

Comments

@tamboril
Copy link

tamboril commented Mar 1, 2018

Trying to make managed heap memory with a 64-byte alignment causes the assertion shown below the code.

This asserts when align > 32 in boost 1.66.0 on CentOS7-64/gcc 7.2:


#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
#include <boost/interprocess/managed_heap_memory.hpp>

using namespace ::std;
using namespace boost::interprocess;

int main(int, char *argv[])
{
    constexpr const static size_t align = 64;

    typedef basic_managed_heap_memory<
        char,
        rbtree_best_fit<mutex_family, offset_ptr<void, long, unsigned long, align>, align>,
        iset_index
    > synchronized_managed_heap_t;

    synchronized_managed_heap_t mem(10000); // asserts when align > 32

    return 0;
}
boost/interprocess/mem_algo/rbtree_best_fit.hpp:410: void boost::interprocess::rbtree_best_fit<MutexFamily,
VoidMutex, MemAlignment>::priv_add_segment(void*, boost::interprocess::rbtree_best_fit<MutexFamily, VoidMutex, MemAlignment>::size_type)
 [with MutexFamily = boost::interprocess::mutex_family; VoidPointer = boost::interprocess::offset_ptr<void, long int, long unsigned int, 64>;
long unsigned int MemAlignment = 64; boost::interprocess::rbtree_best_fit<MutexFamily, VoidMutex, MemAlignment>::size_type = long unsigned int]:
Assertion `priv_end_block() == end_block' failed.
@igaztanaga
Copy link
Member

Reviewing old bugs. Heap memory does not support overaligned types because the heap memory returned by operator new is not guaranteed to be suitable for over-aligned types. I will add this to the documentation.

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