Skip to content

Commit

Permalink
Add a comment explaining why initialize_allocate_handler() is not cal…
Browse files Browse the repository at this point in the history
…led in the current library implementation

Signed-off-by: Dmitri Mokhov <[email protected]>
  • Loading branch information
dnmokhov committed May 10, 2024
1 parent 762b8af commit de2d5d4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/tbb/allocator.cpp
Original file line number Diff line number Diff line change
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

0 comments on commit de2d5d4

Please sign in to comment.