3 ms·
I mean, there shouldn't be any, given how many C++ standard libraries implement `operator new` on top of malloc. If anything it should be less efficient once yo
by maximilianburke 5y ago
I mean, there shouldn't be any, given how many C++ standard libraries implement `operator new` on top of malloc. If anything it should be less efficient once you factor in constructor calls.
libc++: https://github.com/llvm-mirror/libcxx/blob/master/src/new.cpp https://github.com/llvm-mirror/libcxx/blob/master/src/new.cp...
libstdc++: https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/libsupc%2B%2B/new_op.cc https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-...
- jeffbee 5y agoIt is common in C++ to override operators new and delete. When you use tcmalloc in a C++ program it overrides all the global allocator and deallocator operators. When you use tcmalloc in a C program, it just overrides malloc, because there is no richer API available.
- maximilianburke 5y agoAnd the same overriding can be done in a C program with malloc and free, too.