- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using tbb malloc in a project and I wondered what the difference was between using the tbb malloc proxy library and using a header file to redefine the standard memory allocation functions. Something like:
void* operator new(size_t sz)
{
void *res = scalable_malloc(sz);
if (res == NULL)
throw std::bad_alloc();
return res;
}
void operator delete(void* ptr) throw()
{
scalable_free(ptr);
}
What are the advantages/drawbacks to both approaches ? Is one superior to the other ?
void* operator new(size_t sz)
{
void *res = scalable_malloc(sz);
if (res == NULL)
throw std::bad_alloc();
return res;
}
void operator delete(void* ptr) throw()
{
scalable_free(ptr);
}
What are the advantages/drawbacks to both approaches ? Is one superior to the other ?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hellonorswap
In your case you will have more control on what should go to scalable allocator and what shouldn't. tbbmalloc proxy redirects _all_ application calls to scallable_malloc. But our implementation of new/delete in proxy is pretty as the same as above one.
tbbmalloc proxy is a great advantage for big projects that you can add one line to one source and get everything working.
--Vladimir
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting norswap
...What are the advantages/drawbacks to both approaches ?
Please take a look at a thread:
'Difference between scalable_memory and classic memory allocation'
http://software.intel.com/en-us/forums/showthread.php?t=105401&o=a&s=lr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hellonorswap
In your case you will have more control on what should go to scalable allocator and what shouldn't. tbbmalloc proxy redirects _all_ application calls to scallable_malloc. But our implementation of new/delete in proxy is pretty as the same as above one.
tbbmalloc proxy is a great advantage for big projects that you can add one line to one source and get everything working.
--Vladimir
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