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?
Asked
Active
Viewed 167 times
1

kreuzerkrieg
- 3,009
- 3
- 28
- 59
1 Answers
0
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.

sehe
- 374,641
- 47
- 450
- 633
-
Actually, I didnt opt in, it feels like by default it is used. Still not sure, the build takes forever but it feels like it has something to do with `USE_DL_PREFIX` define – kreuzerkrieg Jun 10 '20 at 13:18
-
Ok, looks like defining `USE_DL_PREFIX` did the trick. Did I get you right, your default build (apparently) has it defined by default? Did you build using `bjam`? – kreuzerkrieg Jun 10 '20 at 13:31
-
I never had to link the library to date, and I just checked I DO have to link when using those extended allocator examples. That's opting in! (But do post an answer if `USE_DL_PREFIX` somehow can be used to workaround your issue.) – sehe Jun 10 '20 at 13:45
-
Aha! Found it, `monotonic_buffer_resource` is used in the project, so, in this case library must be built and linked. I guess it is quite rare case when the Boost.Container used as not "headers only" library. Dont want to mess with it and check if I can exclude the allocator from the build, I'll just stick to the define. – kreuzerkrieg Jun 10 '20 at 14:40