Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Free command question

  1. Nov 18, 2008 #1
    do i have to use free command on each node i have constructed

    will it damage my computer if i will leave it as it i now
    (fill out my memory)
    Reply With Quote
  2. jcsd
  3. Nov 18, 2008 #2
    I suppose you are writing code in C.
    Any memory that you have assigned using malloc(), calloc() should be freed using the free() command when you no longer need it.
    This includes memory that has been allocated by functions of the C-Library, such as strdup.
    Yes, failing to free memory properly will cause a memory leak, i.e. fill up your memory unnecessarily.
    If you want to do some reading on the subject, try:
    Also, if you are writing in C++, memory that you have assigned as objects of classes must be freed using the delete command.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook