Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2421 Discussions

tbb function names conflict with MSVC debug heap macros

The following .cpp does not compile under Visual Studio in a Debug build:


Reason: crtdbg.h provides macros for malloc() and free() that track the file and line number of allocations when linking with the Debug heap (Multithreaded Debug, or Multithreaded Debug DLL). Certain TBB classes have member functions with the same name as the standard C library functions. For example:

class allocate_continuation_proxy { void free(); }

Workaround: undefine free before including certain tbb headers when using the MSVC Debug Heap.

A better solution would be to rename free() in all tbb classes (perhaps "deallocate"?).

0 Kudos
0 Replies