checking for memory leaks

This is a discussion on checking for memory leaks within the C++ Programming forums, part of the General Programming Boards category; I did a search, didn't exactly find what I was looking for. I am using mingw 3.2 . Is there ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109

    checking for memory leaks

    I did a search, didn't exactly find what I was looking for.

    I am using mingw 3.2 . Is there a function that can tell you how much memory you have? I want to be sure that I am deleting properly.

    i.e. something similar to coreleft() in borland's alloc.h. I have a book that said I can use this function, but Borland keeps giving me an undeclared error. I have looked at alloc.h and it seems to be in there, but Borland won't let me call it.

    just something I can call at the beginning and end of my programs for debugging purposes.

    Thanks.

  2. #2
    Open to suggestions Brighteyes's Avatar
    Join Date
    Mar 2003
    Posts
    204
    For debugging purposes you can redefine the global operator new. Something simple like incrementing a count when you allocated and decrementing it when you deallocate would be sufficient for most simple purposes. If you end up with the counter anything but 0 you've got a leak.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    hmm...

    didn't think about that. thanks

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, 11:58 AM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  4. Problems about gcc installation
    By kevin_cat in forum Linux Programming
    Replies: 4
    Last Post: 08-09-2005, 09:05 AM
  5. command in unix for checking memory leaks
    By sanju in forum Linux Programming
    Replies: 1
    Last Post: 01-22-2003, 05:51 AM

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