Memory leaks

This is a discussion on Memory leaks within the C++ Programming forums, part of the General Programming Boards category; Are there any programs I can use when I run my code to see if I have any memory leaks ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    28

    Memory leaks

    Are there any programs I can use when I run my code to see if I have any memory leaks in it? Like if I forgot to delete a dynamically created variable in a function that gets called 15 times. Any programs that can tell me if I have a memory leak, and where it is? Thanks.
    -Grunt (Malek)

  2. #2
    ggs
    ggs is offline
    C > C++ duders ggs's Avatar
    Join Date
    Aug 2001
    Posts
    435
    I think there's a free linux program called `electricfence' to find these for you, and I'm sure that there are many others.. But it might be easier to wrap malloc/free or new/delete with your own function that keeps track of how many bytes are allocated and freed.
    .sect signature

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking for memory leaks
    By Bladactania in forum C Programming
    Replies: 5
    Last Post: 02-10-2009, 12:58 PM
  2. memory leaks
    By TehOne in forum C Programming
    Replies: 4
    Last Post: 10-10-2008, 10:33 PM
  3. Tons of memory leaks
    By VirtualAce in forum C++ Programming
    Replies: 11
    Last Post: 12-05-2005, 10:19 AM
  4. COM Memory Leaks
    By subdene in forum Windows Programming
    Replies: 0
    Last Post: 06-07-2004, 12:57 PM
  5. about memory leaks with this simple program
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 04-07-2002, 08:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21