Thread: Memory leaks

  1. #1
    Registered User
    Join Date
    Sep 2001

    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
    C > C++ duders ggs's Avatar
    Join Date
    Aug 2001
    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
    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, 09: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, 11:57 AM
  5. about memory leaks with this simple program
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 04-07-2002, 07:19 PM