Thread: Memory leak

  1. #31
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    I think the whole point is not that valgrind is lying, but that people do not do complete white box testing. If there's a bug in some place the program doesn't go very often and no tool looks at that, everything is going to look fine. When a tree falls in the forest and no one is around to hear it...

  2. #32
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by MK27 View Post
    That's only true WRT "any kind of bug" -- no amount of testing can demonstrate there are no possible bugs of any sort. However, testing can demonstrate that no bug of a particular sort exists, such as a memory leak. At exit, valgrind will give you an allocated/free summary and say "All heap blocks were freed -- no leaks are possible", by which I do not think they mean "nothing is true, everything is permitted", or "there may be leaks, just we did not find any involving your computer's memory", etc.

    There may be plenty of cases where that method won't work, and I've never used it myself, but I think there are plenty of cases where, logically, it will work perfectly.
    "No leaks are possible" would be more correctly interpreted as "It is possible there are no leaks" rather than your "It is impossible there is a leak". You clearly prefer to believe the latter.

    Effective usage of tools like valgrind relies on defining a set of test cases that exercise all possible program flows that affect the relationship between memory allocation and deallocation. If valgrind reports no leaks, that only means the executed test cases do not result in leaks. It does not mean that other test cases (or, worse, user behaviours after release of your program) will not result in leaks.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  3. #33
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Quote Originally Posted by grumpy View Post
    "No leaks are possible" would be more correctly interpreted as "It is possible there are no leaks" rather than your "It is impossible there is a leak". You clearly prefer to believe the latter.

    Effective usage of tools like valgrind relies on defining a set of test cases that exercise all possible program flows that affect the relationship between memory allocation and deallocation. If valgrind reports no leaks, that only means the executed test cases do not result in leaks. It does not mean that other test cases (or, worse, user behaviours after release of your program) will not result in leaks.
    Ah yeah, the good old "user behaviours". I wish there were a tool that can solve stupidity and ignorance. :P
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

  4. #34
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by g4j31a5 View Post
    Ah yeah, the good old "user behaviours". I wish there were a tool that can solve stupidity and ignorance. :P
    There is... it's called "Properly error trapped programming"...

    Input is always harder than output...

  5. #35
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by CommonTater View Post
    There is... it's called "Properly error trapped programming"...
    That is actually necessary but insufficient. The range of techniques for checking errors in input are finite, but the set of possible runtime errors are infinite - particularly with compromised hardware.

    One fatal assumption virtually all programmers make is to assume that the hardware behaves as the software expects it to.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  6. #36
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Quote Originally Posted by CommonTater View Post
    There is... it's called "Properly error trapped programming"...

    Input is always harder than output...
    Don't underestimate human's "ingenuity". I've worked at a company that manufactured arcade prize vending machines. And from the site tests and the client's reports, the players's behaviors were unthinkable. They kicked the machine, brought a portable battery/accu to short the machine, etc. All to win the prize. A few of them worked, a few of them not, all of them hazardous to the machine.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 09-28-2006, 01:06 PM
  2. Memory Leak Help
    By (TNT) in forum Windows Programming
    Replies: 3
    Last Post: 06-19-2006, 11:22 AM
  3. Do I have a memory leak? (SDL)
    By antex in forum Game Programming
    Replies: 3
    Last Post: 03-02-2006, 06:18 PM
  4. Is this a memory leak?
    By jasonhv in forum C++ Programming
    Replies: 5
    Last Post: 10-20-2005, 08:37 PM
  5. A memory leak (I think...)
    By Stevek in forum C++ Programming
    Replies: 7
    Last Post: 03-16-2003, 03:09 PM