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]

valgrind fixes, vector pre-allocation



I'm in the process of running the libstdc++-v3 testsuite, collecting
all the shared executables, and running them under valgrind, which is
an uber-leak-finder. I would like to have a valgrind-clean-libstdc++
as soon as possible.

So far, I've changed the way locales are initialized, in particular
most of the lossage from the "C" locale being leaked. From 52
allocations, I'm now down to 19.....

However, getting rid of the rest means either

1) special-casing std::locale("C")'s _Impl data structure....

2) or finding a way to pre-allocate the _M_facets member for std::locale("C").

Perhaps there are other ways, but these two seem the most likely
chances for success.

I'm looking for help and ideas for the second option. Although a
vector of facet*'s is cool, it's a bit of overkill for a locale that
isn't going to grow or change. Especially when std::vector(28, 0) ends
up allocating 4400 bytes.

Here's a simple C++ example that explains what I'd like to
do. Suggestions and help will be mightily appreciated.....


#include <vector>

typedef std::vector<void*> vector_type;

struct impl
{
  vector_type	_M_facets;

  impl(bool = false) : _M_facets(28) { }
};

int main()
{
  impl test; // so that no allocations take place......
  return 0;
}










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