Jeffery Browning wrote:

> We have a C program that allocates dynamic memory structures during

> execution. As new data sets are retrieved, the memory structures are

> deallocated and reallocated to accomodate the new data set. All this is

> being handled properly. My question is this: "When the user exists the

> program by way of a function that shuts it down, do I, as the

> programmer, need to deallocate memory for data structures that may be in

> use, or does the action of terminating the program release this memory

> for me?"

Good programming style mandates that the memory should be explicitly freed.

However, POSIX mandates that the OS should free all memory belonging to a

program's heap when it exits (which can be observed when the system does not lose

resources after big programs like Netscape crash). Among other things, explicitly

freeing memory will facilitate portability to less "enlightened" platforms that

aren't so nice about memory recovery.

-Reeves


--
J. Reeves Hall, Georgia Tech CS Major
Linux #3 SMP Sat Dec 4 02:21:17 EST 1999
9:14am  up  6:07,  4 users,  load average: 0.10, 0.14, 0.16
--
To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.