Boost.Container `dlmalloc` and `jemalloc`

197 Views Asked by At

I've introduced Boost.Container into my project which uses jemalloc as default allocator, looks like Boots.Container uses custom allocator which is dlmalloc and of course when linking I'm failing on "multiple definition" linkage error since two "XXXalloc" were introduced into object files. Turning the 'jemalloc' off is not an option but I cant find if it is possible to turn off the dlmalloc usage. Any idea how to solve this problem?

1

There are 1 best solutions below

4
sehe On

In reality, Boost Container is 99% header-only.

The documentation lists the DLMalloc extension as an extension: https://www.boost.org/doc/libs/1_73_0/doc/html/container/extended_allocators.html

This means you have apparently opted in to the extended allocator. If that's not what you wanted, you know what to remove.

A good hint is when you don't need to link Boost Container, as a quick inspection of the symbols exported didn't show me anything I recognize except allocator stuff.