Good numbers from Ritter's new string allocator
Benjamin Kosnik
bkoz@redhat.com
Tue Nov 13 09:48:00 GMT 2001
It's looking like this should go in. Nathan, thoughts?
There is a bunch of stuff in std::string::_Rep to do with allocations. Is it
supposed to handle this kind of tuning gracefully? If so, how? It seems
obvious to me that the default allocation strategy is way off, and should
be fixed.
In particular:
#if _GLIBCPP_ALLOC_CONTROL
// These function pointers allow you to modify the allocation
// policy used by the string classes. By default they expand by
// powers of two, but this may be excessive for space-critical
// applications.
// Returns true if ALLOCATED is too much larger than LENGTH
static bool (*_S_excess_slop) (size_t __length, size_t __allocated);
inline static bool
__default_excess(size_t, size_t);
#else
inline static bool
_S_excess_slop(size_t, size_t);
#endif
-benjamin
More information about the Libstdc++
mailing list