This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] allocator switches


Here's an approach to solving the default allocator dilemma.

This patch removes _Alloc_traits, and __simple_alloc, etc. All support
for SGI style allocators is now removed. 

The default allocator, std::allocator, just inherits from one of the
standard-style allocators and uses them as the "underlying allocator,"
in a real sense. Currently, only standard-style allocators work, ie,
new_allocator, malloc_allocator, and __mt_alloc.

Thusly, this patch just punts to __mt_alloc, since it's done now. All
the ext allocators that have internals are now instantiated in the library,
but not exported. This seems to be the sane approach for people
who'd like to be able to use alternate allocators.

I'd toyed with making bits/allocator.h configurable (ie ./configure ...
--enable-libstdcxx-default-allocator=foo) and am open to this idea. I
think keeping the current bits/allocator.h is probably unwise, as it may
give people the mistaken impression that they can just edit this header
file, switch the default allocator, and have things work. It won't: the
default allocator will mangle the same. 

I don't see the final presentation of the default underlying allocator
as something that has to get fixed right away, however.

I'm open to other ideas...... I think the only way to really deal with
replacing allocators is to explicitly name them as part of the type
name, and forget about the default allocator.

There are still two bits that need to go into __mt_alloc. One, the
switch to new/delete from malloc/free (This shows up as an
allocator/1.cc fail in the testsuite runs when it's the default). The
other is GLIBCXX_FORCE_NEW support. 

Also, __pool_alloc. And __mt_alloc. Please, let's figure out better
names. That can come later, though. As can the patch to convert
__pool_alloc, which I hope to pawn off on Matt...

I'll sit on this until I have some feedback.

tested x86/linux, new fails
FAIL: 20_util/allocator/1.cc execution test
FAIL: thread/pthread7-rope.cc execution test
 

Attachment: p.20040128-1.patch
Description: Text document


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