Article View: comp.os.msdos.programmer
Article #7873Re: Freeing memory in #pragma exit
From: The Amorphous Mass
Date: Wed, 06 Sep 1995 21:28
Date: Wed, 06 Sep 1995 21:28
21 lines
1543 bytes
1543 bytes
On 5 Sep 1995, William White wrote: > Is it better to free all allocated memory from new & malloc()... by freeing > it with a #pragma exit function, or a regular function just before exit() is > called? Using the #pragma exit way, I've been getting some lockup in my > program... :( #pragma exit (or #pragma _anything_) is non-portable. When you're programming in C, deallocate all malloc()'d memory with the "regular" Standard Library function free(). In C++, use the "regular" keyword delete to destroy all objects you allocate with new. *Never* mix new and malloc(), or delete and free(), in the same program. They are *not* guaranteed to cooperate, and since they belong to two different languages there's no reason that they should. ___________ Bushido, n.: the ancient art of keeping your | James Robinson cool when a US President ralphs in your lap. | james-f-robinson@uiowa.edu
Technical Details
Message-ID:
<Pine.A32.3.91.950906162421.53310C-100000@black.weeg.uiowa.edu>Path:
arc1-ca.pugleaf.net!black.weeg.uiowa.edu!robinsonReferences:
<42hdl3$rkr@ratty.wolfe.net>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!black.weeg.uiowa.edu!robinson From: The Amorphous Mass <robinson@blue.weeg.uiowa.edu> Newsgroups: comp.os.msdos.programmer,comp.lang.c Subject: Re: Freeing memory in #pragma exit Date: Wed, 6 Sep 1995 16:28:03 -0500 Organization: University of Iowa, Iowa City, IA, USA Distribution: world Message-ID: <Pine.A32.3.91.950906162421.53310C-100000@black.weeg.uiowa.edu> References: <42hdl3$rkr@ratty.wolfe.net> NNTP-Posting-Host: black.weeg.uiowa.edu Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Sender: robinson@black.weeg.uiowa.edu In-Reply-To: <42hdl3$rkr@ratty.wolfe.net>