]> Creatis software - gdcm.git/commitdiff
* Memory leak hunt with the following command:
authorfrog <frog>
Mon, 14 Jun 2004 08:35:35 +0000 (08:35 +0000)
committerfrog <frog>
Mon, 14 Jun 2004 08:35:35 +0000 (08:35 +0000)
      valgrind --leak-check=yes --leak-resolution=high --num-callers=40
               --show-reachable=yes gdcmTests PrintDocument
      It looks like many (all?) leaks are due to the STL (or a bad usage
      of the STL. The lines producing the leaks now have a comment with
      a "MEMORY LEAK" tag: you can retrieve them with
          grep "MEMORY LEAK" src/*
      Here are two typical examples which I can't help fixing:
      -----
          #include <string>
          int main() {
             std::string name;
             char * test = "babo";
             name = test;    //// <--- valgrind detects 960 bytes lost in
                             ////   call to std::string::operator=(char const*)
             name.clear();   //// Doesn't help !
             return 0;
          }
      -----
          #include <string>
          #include <iostream>
          int main() {
             std::string line;
             std::cout << "Type a bunch of characters followed by RETURN: ";
             getline(std::cin, line);   //// <--- valgrind dectects a loss
                                        //// of 1320 bytes in call to
                                        /// std::basic_istream<>& std::getline<>
             return 0;
          }
      -----


No differences found