From: Jeremy F. <je...@go...> - 2003-04-01 06:31:52
|
On Mon, 2003-03-31 at 20:47, Geoff Alexander wrote: > In running valgrind 1.0.4 against a small program of mine, > valgrind reports "still reachable" memory at exit, both with g++ > 2.95.2 and gcc 3.2 on SuSE Linux x86 7.1. I've tracked the problem > down to std::string. Here's a small program that illustrates the > problem: > > #include <cstdlib> > #include <string> > int main(int argc, char* argv[]) > { > { > std::string s; > s += '0'; > } > exit(0); > } What happens if you return 0 rather than exit(0)? I'm not sure that s will necessarily have been destructed if you use exit. J |