| delorie.com/archives/browse.cgi | search |
| From: | "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT nortelnetworks DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: About memory allocation |
| Date: | Wed, 25 Aug 1999 10:10:48 -0400 |
| Organization: | Nortel Networks |
| Lines: | 29 |
| Message-ID: | <37C3F967.96979C17@NortelNetworks.com> |
| References: | <Fvdw3.325$Os5 DOT 51835 AT wagner DOT videotron DOT net> <37C19A5C DOT 51C150AF AT cartsys DOT com> <0E16861EE7BCD111BE9400805FE6841F0B1B54D7 AT c1s5x001 DOT cor DOT srvfarm DOT origin-it DOT com> |
| NNTP-Posting-Host: | bmerhc00.ca.nortel.com |
| Mime-Version: | 1.0 |
| X-Mailer: | Mozilla 4.7 [en] (X11; I; HP-UX B.10.20 9000/712) |
| X-Accept-Language: | en |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Bas Hamstra wrote:
> >OmniMeta wrote:
> >>
> >> My question is :
> >> if i do this :
> >>
> >> int *p;
> >> int main()
> >> {
> >> p = new int;
> >> return 0;
> >> }
> >>
> >> Here I didn't use the delete operator to free p
> >> Did p will be automaticaly deleted with the end of the program, or did p
> >> will stay in memory until i reboot ?
>
> >When your program exits, all memory allocated by `malloc' or `new' is
> >freed.
> Is the memory also freed when your program exits with exit(n) ?
Yes, but destructors are not called. (as least they weren't in 2.8.1)
--
-Rolf Campbell (39)3-6318
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |