On Monday 19 June 2006 12:01 pm, Verdi March wrote:
Often I dynamically allocate memory that I know it is going to be used until a program terminates. Though I'll keep pointers to these memory (thus, reachable from main()), I don't bother to explicitly free() these pointers when the program is about to terminate. Afterall, after the program terminates, its address space will be reclaimed by the system. This is a poor programming practice. One should always release allocated memory after it is no longer needed.
The C language standard does not guarantee that allocated memory will be
reclaimed by the system. However, nearly all Unix and Linux systems do this
for you. But, I once worked on an IBM mainframe system where this was not
the case, and we had a memory leak that prevented the application from
being reloaded without a logout.
--
Jerry Feldman