[GRASS5] Module memory management - G_set_error_routine()

Brad Douglas rez at touchofmadness.com
Tue Mar 22 04:10:46 EST 2005


On Mon, 2005-03-21 at 23:08 +0000, Glynn Clements wrote:
> Brad Douglas wrote:
> 
> > Would it be acceptable practice to use the following function to free
> > memory resources before exit (for fatal errors)?
> 
> The OS automatically recovers the process' memory when the process
> terminates.

My copy of glibc would beg to differ (_MALLOC_CHECK environ variable).
Besides, it's just very bad practice not to explicitly free resources.

> If you want to perform specific tasks (e.g. deleting temporary files)
> upon termination, use atexit().

This is what I am doing at the moment.  After I actually looked at the
code behind G_set_error_routine(), it became evident that it would not
work for my purposes.


It would be nice to have a virtual function for freeing resources upon
fatal error, though.


-- 
Brad Douglas <rez at touchofmadness.com>




More information about the grass-dev mailing list