Article View: comp.std.c
Article #4058Re: Is malloc()ed storage freed upon program termination?
From: Christopher R. Volpe
Date: Wed, 20 Sep 1995 15:59
Date: Wed, 20 Sep 1995 15:59
25 lines
1658 bytes
1658 bytes
In article <811549923.10778@contech.demon.co.uk>, sbehrens@contech.demon.co.uk (Soenke Behrens) writes: >jimh@earth.execpc.com (Jim Hennessy) wrote: > >>Does the C standard guarantee that storage allocated by malloc() is >>freed during program termination? If so, where? I can't find it. > >Nope, this is not guaranteed. You _have_ to free all allocated memory >yourself. A good strategy would be to work out (before you start coding) >who is allowed to allocate memory, and who frees it again. A tool like >memcheck does wonders, too. This is silly. Free() doesn't guarantee that the storage is returned to the operating system either. It just makes it available for further mallocs by the program. If an operating reclaims storage used by a process, it won't matter whether malloc tables internal to the process have that storage marked as available or in-use. And if it doesn't reclaim storage, calling free() isn't going to help. It's an OS issue. -- Chris Volpe Phone: (518) 387-7766 (Dial Comm 8*833 GE Corporate R&D Fax: (518) 387-6560 PO Box 8, Schenectady, NY 12301 Email: volpecr@crd.ge.com
Technical Details
Message-ID:
<43pdon$b3i@rdsunx.crd.ge.com>Path:
arc1-ca.pugleaf.net!bart.crd.ge.com!volpeReferences:
<43l16d$3dp@homer.alpha.net> <811549923.10778@contech.demon.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe From: volpe@bart.crd.ge.com (Christopher R. Volpe) Newsgroups: comp.std.c Subject: Re: Is malloc()ed storage freed upon program termination? Date: 20 Sep 1995 15:59:19 GMT Organization: GE Corporate Research & Development Sender: volpe@bart (Christopher R. Volpe) Distribution: world Message-ID: <43pdon$b3i@rdsunx.crd.ge.com> References: <43l16d$3dp@homer.alpha.net> <811549923.10778@contech.demon.co.uk> Reply-To: volpe@ausable.crd.ge.com NNTP-Posting-Host: bart.crd.ge.com