On Tuesday 20 June 2006 03:38, Jerry Feldman wrote:
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
I would just like to agree with Jerry: I worked with a company where C++ programmers didn't keep tight tabs on memory and the system just chewed up memory until it crashed. Customers were forced to regularly re-boot Windows to clear memory. As Jerry said: poor programming. Colin