[v3] extern/fixed-memory/archive allocator
Gabriel Dos Reis
gdr@cs.tamu.edu
Wed Sep 29 14:03:00 GMT 2004
Benjamin Kosnik <bkoz@redhat.com> writes:
| I'm planning on using this in place of the current strategy for
| allocating global objects. Seems to work well in preliminary tests, but
| I post this for more comments.
|
| This is just a way of taking existing storage and fitting it in to the
| std::allocator model so that STL, string, etc can use it. It can be thought of
|
| http://gcc.gnu.org/ml/libstdc++/2003-01/msg00103.html
|
| crossed with src/global*.cc
|
| Actually I'd like to experiment with pre-allocating space for pools in
| mt_alloc with this. But, that's a later patch.
I really like the general idea. And I'd like to see our basic_string
use that technique too. However I think we would need first to fix the
front-end so that this works properly
+ typedef char layout_type[sizeof(_Tp)]
+ __attribute__ ((aligned(__alignof__(_Tp))));
Also, I'm wondering whether it should not be
typedef char storage_type[sizeof(_Tp)];
storage_type _M_instance __attribute__((__aligned__(__alignof(_Tp))));
(as I remember -- maybe that is fixed now -- attributes on array
typedefs used to be silently stripped)
We might want to abstract that into a standalone class, as it
basically implement the aligned_storage functionality in TR1.
-- Gaby
More information about the Libstdc++
mailing list