Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2455 Discussions

tbb function names conflict with MSVC debug heap macros

thevinn
Beginner
167 Views
The following .cpp does not compile under Visual Studio in a Debug build:

#define _CRTDBG_MAP_ALLOC
#include
#include

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
Reply