Suggestion for mt_alloc.

Brad Spencer spencer@infointeractive.com
Tue Feb 10 18:33:00 GMT 2004


On Sun, Feb 08, 2004 at 10:52:51AM +0530, Dhruv Matani wrote:
> Why not keep mt_alloc a proper multi_thread allocator ONLY. No ST
> support, and when __GTHREADS is not defined, use the default pool
> allocator without thread support.

What about single-threaded programs compiled with a threads-enabled
gcc?  I would wager that most "packaged" installations of gcc come
configured for "--enable-threads=posix", and those compilers are used
to build both threaded and non-threaded applications. 

In my comment about thread_id, I was observing if we _know_ we don't
have any threads, we may as well save the memory.  However, if
__GTHREADS is not defined, there may be many threads, so we should
offer a good MT allocator, but there still may be only one thread, so
the ST performance of the offered allocator should be very good, too.

I think ensuring that an "--enable-threads=posix" compiler supports
good single-threaded allocation performance is a worthwhile goal.

-- 
------------------------------------------------------------------
Brad Spencer - spencer@infointeractive.com - "It's quite nice..."
Systems Architect | InfoInterActive Corp. | A Canadian AOL Company



More information about the Libstdc++ mailing list