- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've a lot of questions about using tbb allocators :
- When I include the file
in a file of an DLL, I understand that all new/delete functions are replaced by the tbb allocators, isn't it ? - Are allocators of std::set, std::list... are automatically replaced by the tbb allocators ?
- Or do I have to affect manually tbb_allocator for each STL containers ?
- If I include in an application, a DLL compile with tbbmalloc_proxy, are allocators used in the application are replaced by the tbb allocators ? I think Yes, if I include a DLL .h containing the tbbmalloc_proxy.h. But if any .h files of the DLL don't include the tbbmalloc_proxy ?
- Is it dangerous to include in an application, DLLs including tbbmalloc_proxy, with DLLs using default C++ allocators ?
- For a DLL, if I include the file
in only one .cpp file, is all code of my DLL will be affected by the tbb allocators ?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Only global new/delete operators are replaced. If new/delete is overloaded in some class, it's not replaced. Also please note that DLL with overload must be loaded during application startup.
2. If you use some custom STL allocators, they are not automatically replaced. Default allocators call global new, so TBB allocator would be used for such containers automatically.
3. Generally no, but you can look at cache_aligned_allocator if false sharing is a problem for a particular container usage.
4. Yes, but DLL must be loaded during application startup. There is nothing magic in tbbmalloc_proxy.h usage. You can use either include tbbmalloc_proxy.h or add tbbmalloc_proxy.lib /INCLUDE:"___TBB_malloc_proxy" to linker command line, result is the same.
5. No.
6. Yes, and even all the process wll use TBB allocator.
2. If you use some custom STL allocators, they are not automatically replaced. Default allocators call global new, so TBB allocator would be used for such containers automatically.
3. Generally no, but you can look at cache_aligned_allocator if false sharing is a problem for a particular container usage.
4. Yes, but DLL must be loaded during application startup. There is nothing magic in tbbmalloc_proxy.h usage. You can use either include tbbmalloc_proxy.h or add tbbmalloc_proxy.lib /INCLUDE:"___TBB_malloc_proxy" to linker command line, result is the same.
5. No.
6. Yes, and even all the process wll use TBB allocator.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Only global new/delete operators are replaced. If new/delete is overloaded in some class, it's not replaced. Also please note that DLL with overload must be loaded during application startup.
2. If you use some custom STL allocators, they are not automatically replaced. Default allocators call global new, so TBB allocator would be used for such containers automatically.
3. Generally no, but you can look at cache_aligned_allocator if false sharing is a problem for a particular container usage.
4. Yes, but DLL must be loaded during application startup. There is nothing magic in tbbmalloc_proxy.h usage. You can use either include tbbmalloc_proxy.h or add tbbmalloc_proxy.lib /INCLUDE:"___TBB_malloc_proxy" to linker command line, result is the same.
5. No.
6. Yes, and even all the process wll use TBB allocator.
2. If you use some custom STL allocators, they are not automatically replaced. Default allocators call global new, so TBB allocator would be used for such containers automatically.
3. Generally no, but you can look at cache_aligned_allocator if false sharing is a problem for a particular container usage.
4. Yes, but DLL must be loaded during application startup. There is nothing magic in tbbmalloc_proxy.h usage. You can use either include tbbmalloc_proxy.h or add tbbmalloc_proxy.lib /INCLUDE:"___TBB_malloc_proxy" to linker command line, result is the same.
5. No.
6. Yes, and even all the process wll use TBB allocator.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page