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

Add a comment explaining why initialize_allocate_handler() is not called in the current library implementation #1380

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/tbb/allocator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2005-2023 Intel Corporation
Copyright (c) 2005-2024 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -157,6 +157,14 @@ void initialize_cache_aligned_allocator() {
}

//! Executed on very first call through allocate_handler
/** Only one of initialize_allocate_handler() and initialize_cache_aligned_allocate_handler()
is called, since each one of them also initializes the other.

In the current implementation of oneTBB library initialization, cache_aligned_allocate() is
used, which in turn calls initialize_cache_aligned_allocate_handler(). As mentioned above,
that also initializes the regular allocate_handler.

Therefore, initialize_allocate_handler() is not called in the current library implementation. */
static void* initialize_allocate_handler(std::size_t size) {
initialize_cache_aligned_allocator();
__TBB_ASSERT(allocate_handler != &initialize_allocate_handler, nullptr);
Expand Down
Loading