Em segunda-feira, 17 de outubro de 2016, às 11:23:29 PDT, Marc Mutz escreveu:
> Please don't equate 'resource' with 'memory'. Memory is just one of many
> resources a program may have acquired, and the _only_ resource which does
> not need to be released at program exit.
Well, no. It does not need to close file descriptors either, they are closed by
the OS. In fact, most OS resources are automatically freed when the
application exits, though on Unix systems that's usually associated with file
descriptors, such as file locks.
It may have to do the proper shutdown protocol on them, be it save the proper
data, send the proper disconnection information on a socket or remove
temporary files. But there are a couple of file descriptors applications seldom
ever close, like stdin, stdout and stderr.
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
Development mailing list