From: Geoff A. <gal...@nc...> - 2003-04-02 04:34:17
|
----- Original Message -----=20 From: Jeremy Fitzhardinge=20 To: Geoff Alexander=20 Cc: val...@li...=20 Sent: Tuesday, April 01, 2003 1:31 AM Subject: Re: [Valgrind-users] "still reachable" memory from = g++'sstd::string On Mon, 2003-03-31 at 20:47, Geoff Alexander wrote:=20 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:=20 #include <cstdlib> #include <string> int main(int argc, char* argv[]) { { std::string s; s +=3D '0'; } exit(0); }=20 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.=20 J=20 Thanks for the suggestion. Using return 0 rather than exit(0) didn't = change anything. I verified under gdb that s is being destructed in = both cases. Geoff Alexander |