Thread: don't we need to release memory before exit(1)?

  1. #1
    Registered User
    Join Date
    Dec 2008

    don't we need to release memory before exit(1)?

    Dear there,

    I learned to release everything malloced before exit. however this code from doesn't do it.
    tsearch(3): manage binary tree - Linux man page

    is it wrong or I missed something?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Since the OS in question will reclaim the memory anyway, it is not necessary. On the other hand, getting into the habit of not releasing memory when you are done with it can be a Bad Thing.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory Fragmentation with Dynamic FIFO Queue
    By fguy817817 in forum Linux Programming
    Replies: 17
    Last Post: 10-31-2009, 04:17 AM
  2. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  3. Memory usage and memory leaks
    By vsanandan in forum C Programming
    Replies: 1
    Last Post: 05-03-2008, 05:45 AM
  4. What's the difference?
    By Stonehambey in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 10:26 AM
  5. Error when freeing memory
    By foniks munkee in forum C Programming
    Replies: 9
    Last Post: 03-01-2002, 08:28 PM

Tags for this Thread