Re: how to release memory?
- From: pereges <Broli00@xxxxxxxxx>
- Date: Thu, 26 Jun 2008 09:36:09 -0700 (PDT)
I also have a few doubts with regard to releasing memory and other
resources. When an error occurs at some point in the program then
usually we proceed by printing an error message and propogating a flag
backwards ( return (1) ) indicating error. Is it a good policy to
release all the resources which were held up till then (when the error
occured) in the program. For eg. a file may be open which must be
closed, a data structure that must be freed etc. It can vary at
different points in the program, different resources may have to be
freed depending on what was allocated till that point. At the very end
(just before main process ends) all the resources can be freed.
.
- Follow-Ups:
- Re: how to release memory?
- From: santosh
- Re: how to release memory?
- References:
- how to release memory?
- From: mynews
- Re: how to release memory?
- From: Keith Thompson
- Re: how to release memory?
- From: Bartc
- Re: how to release memory?
- From: Chris Dollin
- how to release memory?
- Prev by Date: Re: How to learn C ?
- Next by Date: Re: types, variable names and fields
- Previous by thread: Re: how to release memory?
- Next by thread: Re: how to release memory?
- Index(es):
Relevant Pages
|