I wanted to try out TBB\'s scalable_allocator, but was confused when I had to replace some of my code. This is how allocation is done with the allocator:
Som
You'll need to use placement new after getting the raw memory from malloc.
placement new
malloc
void* mem = malloc(sizeof(S)); S* s = new (mem) S(); //this is the so called "placement new"
When you're done with the object you have to make sure to explicitly call its destructor.
s->~S(); free(mem);