What is the best solution to replace a new memory allocator in an existing code?

Posted by O. Askari on Stack Overflow See other posts from Stack Overflow or by O. Askari
Published on 2009-10-05T12:23:15Z Indexed on 2010/03/28 23:33 UTC
Read the original article Hit count: 161

Filed under:
|
|

During the last few days I've gained some information about memory allocators other than the standard malloc(). There are some implementations that seem to be much better than malloc() for applications with many threads. For example it seems that tcmalloc and ptmalloc have better performance.

I have a C++ application that uses both malloc and new operators in many places. I thought replacing them with something like ptmalloc may improve its performance. But I wonder how does the new operator act when used in C++ application that runs on Linux? Does it use the standard behavior of malloc or something else?

What is the best way to replace the new memory allocator with the old one in the code? Is there any way to override the behavior or new and malloc or do I need to replace all the calls to them one by one?

© Stack Overflow or respective owner

Related posts about c++

Related posts about linux