Re: Memory leak
On 27 Oct 2006 22:14:08 -0400, "Alex" <dialectics@yahoo.com> wrote in
comp.lang.c++.moderated:
Is the program still leak memory?
int main()
{
Type *atype = new Type();
// use the atype
....
ruturn 0;
}
The program never call delete but terminate itself. Does the kernel will
close all the open file descriptors for the process and releases all the
memory that it was used?
What kernel would that be?
The C++ language guarantees that any streams opened with C++ stream
functions or with C FILE * functions are closed. It doesn't define or
understand what "file descriptors" are, or what a "process" is. These
are artifacts of your operating system, not of the C++N language.
Also, no programming language, not C++, or C, or FORTRA,N or COBOL,
can dictate what an operating system does before it runs a program, or
after the program terminates. The programming language standards do
not dictate the operation of operating systems.
If you want to know what _your_ operating system does if you terminate
a C++ program without freeing all memory that it allocated, you need
to ask in a group that supports your particular compiler/OS
combination.
Depending on what operating system that is, you might want one of the
following groups:
news:comp.os.ms-windows.programmer.win32
news:comp.unix.programmer
news:comp.os.linux.development.apps
Or perhaps some other, since you did not specify your operating
system.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]