This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Fwd: Pthread options (was: Re: Memory allocators / STL)]

Loren James Rittle wrote:
[What about -D__USE_MALLOC?]

Related to threading or otherwise, the current recommendation is that
users not add any macro defines on the command line to enable features
out of libstdc++-v3.  There is no condition under which it will help
you without causing other issues to perhaps raise up (possible
linkage/ABI problems).

In particular, __USE_MALLOC should only be added to a libstdc++-v3
configuration file, include/bits/c++config (where such user action is
cautioned against), and the entire library should be rebuilt.  If you
do not, then you might be violating the one-definition rule of C/C++
and you might cause yourself untold problems.

Also, I will tell you that I personally performance tested the
implication of enabling __USE_MALLOC against (threaded and
non-threaded) application code I have here.  The slow down for heavy
STL container code was incredible.  It is possible that my code is not
representative, but others were complaining about a "massive" slowdown
in container speed between 2.95 and pre-3.0 libstdc++-v3 releases so I
think not.  The results were posted back when we flipped the default
configuration of libstdc++-v3 just before gcc 3.0 was released to
match that of libstdc++-v2 as was shipped with gcc 2.95.X.

If you find any platform where gcc reports a threading model other
than none and where libstdc++-v3 builds a buggy container allocator
when used with threads unless you define __USE_MALLOC, I want to hear
about it ASAP.  In the past, correctness was the main reason people
were led to believe that they should define __USE_MALLOC when using

As far as i can tell from the resulting config files the GCC 3.0.1 configure script has found the pthreads library on the Slackware 8.0 system we are using.
However i still can't get the application to work properly without the __USE_MALLOC define and i can see that the idea of a caching memory allocator would give us the extra speed that we need.

This is so over my head that i need some pointers on how to go ahead with the debugging...

Thanks in advance!


Military intelligence is a contradiction in terms.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]