-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Allow to disable tbbmalloc (oneTBB) #326
base: master
Are you sure you want to change the base?
Allow to disable tbbmalloc (oneTBB) #326
Conversation
By setting TBB_USE_MALLOC environment variable to 1 the user can disable scalable allocator from tbbmalloc and use system allocator through malloc/posix_memalign/free API. There are other, more performant memory allocators, like tcmalloc for example, which the user might want to use instead of tbbmalloc. Also, using the system allocator can be useful with memory debugging and profiling tools, like valgrind. Such tools usually provide their own implementations of memory allocation functions, and we want those functions to be used by TBB. Signed-off-by: Andrey Semashev <andrey.semashev@gmail.com>
e9ed85c
to
ca7648e
Compare
The patch to enable support for |
if (!GetBoolEnvironmentVariable("TBB_USE_MALLOC")) | ||
success = dynamic_link(MALLOCLIB_NAME, MallocLinkTable, 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered an approach to extend global_control
functionality? Usually, we try to avoid configuration via environment variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the rationale and discussion about global_control
is in the previous version of this PR: #149. The short version is that we want to ensure that tbbmalloc is not enabled if TBB is used somewhere during global initialization of the program, and we want to propagate that setting to child processes.
This is an updated version of #149 which targets the reworked code base of oneTBB 2021.1.1.
The patch adds
TBB_USE_MALLOC
environment variable to force using system allocator.By setting
TBB_USE_MALLOC
environment variable to 1 the user can disable scalable allocator from tbbmalloc and use system allocator throughmalloc
/posix_memalign
/free
API. There are other, more performant memory allocators, like tcmalloc for example, which the user might want to use instead of tbbmalloc. Also, using the system allocator can be useful with memory debugging and profiling tools, like valgrind. Such tools usually provide their own implementations of memory allocation functions, and we want those functions to be used by TBB.The original PR #149 contains some benchmarks and rationale as to why we prefer an environment variable as a way to disable tbbmalloc.