Checking to see if all memory is free

This is a discussion on Checking to see if all memory is free within the C Programming forums, part of the General Programming Boards category; I want to make sure all memory is free (From malloc). I'm barely allocating space, so I can't really tell ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    68

    Checking to see if all memory is free

    I want to make sure all memory is free (From malloc). I'm barely allocating space, so I can't really tell from System Monitor. Not to mention everything on google is people complaining about Windows using all of their memory up.

    What's the best way to make sure I free everything?

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Have you tried using a debugger?

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    6
    If you are barely allocating any space the easiest way should be to just make sure you have a free that corresponds to each malloc. Does your program run continuous or for long periods of time? This is really the only time you should have to worry about memory leaks(assuming you are running code in user mode). Upon program termination Windows should free any and all of the memory that was allocated for that program. Obviously this is bad form. As long as you free your mallocs you should have no worries.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 12:57 AM
  2. Memory leak with detached pthreads - how to free?
    By rfk in forum Linux Programming
    Replies: 2
    Last Post: 08-17-2007, 06:50 AM
  3. free memory in structure
    By franziss in forum C++ Programming
    Replies: 22
    Last Post: 01-08-2007, 04:16 PM
  4. Any Memory Leak Checking Tool?
    By George2 in forum C Programming
    Replies: 4
    Last Post: 06-21-2006, 11:02 PM
  5. Replies: 12
    Last Post: 06-24-2005, 04:27 PM

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