Selecting the standard allocation method to suit performance (C++)

You can select the allocation method used by the standard allocator of the C++ Standard Library to suit the performance needs of the application. For instance, in a non-threaded application you might want to use a pooled allocation strategy for standard allocators. This tends to be faster than the classic allocator for allocating small objects. However, there might be some instances when the classic allocator is preferable, as in the case where an application provides its own fast versions of the operator new() and operator delete() operators. In this case, the pooled allocators might not increase the performance and will incur a greater memory overhead.

To use the pooled std::allocator, do one of the following steps:
To use the "classic", non-pooled std::allocator, do one of the following steps:

In all applications, threaded and non-threaded, if no macro is specified, the "classic", non-pooled allocators are used by default; they have no effect on performance. In applications that link to libpthreads.a, the "classic", non-pooled allocators are always used, and the macro __IBM_ENABLE_POOLED_ALLOCATORS__ has no effect. Pooled allocators are not thread-safe and are not available in threaded programs.

Note: All compilation units in a program, including those located in a static or shared library, must be compiled with the same allocation strategy macro. If a program is composed of a mix of object files where some objects have been compiled with __IBM_ENABLE_POOLED_ALLOCATORS__, while other objects have been compiled with __IBM_ENABLE_CLASSIC_ALLOCATORS__ (this includes cases where neither macro was defined, and so the default "classic" setting was selected), unexpected behavior, including program crashes, can occur.