Mail Archives: djgpp/1998/03/28/13:41:30
At 04:25 3/28/1998 GMT, Edward Cashin wrote:
>Hello. I hear continually that it is good
>programming practice to have a call to free for every call to
>malloc. It certainly makes sense to free memory once it will
>no longer be used in the program. However, there will be cases
>in which dynamically-allocated memory doesn't need to be freed
>until the program exits.
>
>I have not had trouble so far exiting without freeing memory
>allocated with a call to malloc, and AFAIK that is because W95
>has been nice, freeing up all the memory after my program exits.
>I could be wrong: maybe djgpp's exit routines take care of it.
They do. The only things you *need* to free yourself (AFAIK) are selectors
and memory allocated directly from `__dpmi' functions.
The only part W95/DOS has to free is the initial space into which it loaded
the real-mode stub, and it's impossible to free that yourself. You'll have
to trust it here. :)
Nate Eldredge
eldredge AT ap DOT net
- Raw text -