linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-c-programming <linux-c-programming@vger.kernel.org>
Subject: Re: Newbie question on malloc()
Date: Wed, 2 Jun 2004 20:37:34 +0200	[thread overview]
Message-ID: <20040602183734.GU20632@lug-owl.de> (raw)
In-Reply-To: <16574.4399.288522.256729@cerise.nosuchdomain.co.uk>

[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]

On Wed, 2004-06-02 18:41:03 +0100, Glynn Clements <glynn.clements@virgin.net>
wrote in message <16574.4399.288522.256729@cerise.nosuchdomain.co.uk>:
> John T. Williams wrote:
> > As I understand it, that is entirely up to the operation system.  Linux
> > and NT Kernel systems do reclaim unfreed memory, however I believe one
> > the major problems with Win98 was that it did not.
> > 
> > Anyone with more information feel free to correct me
> 
> I very much doubt that the above is accurate.
> 
> It may be that Win98 had some specific memory leaks, but any OS which,
> in the general case, failed to recover a process' memory upon
> termination would run out of memory very quickly.

Well, that all depends on the definition of "OS". Any recent 32+ bit
operating system with virtual memory capabilities and multi-processing
will reclaim malloc()ed RAM upon process termination.

However, there are some minor operating systems (as I said, depends on
definition) out there under which processes *need* to free() their
memory. But if we talk about Linux, *BSD (right, and even Windows
systems starting from Win 3.1) will reclaim memory:)

However, if your program is designed so that you can easily track all
allocations, it doesn't harm if you free everything before exit...

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-06-02 18:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-02 11:48 Newbie question on malloc() Wen Guangcheng
2004-06-02 17:08 ` John T. Williams
2004-06-02 17:41   ` Glynn Clements
2004-06-02 17:52     ` John T. Williams
2004-06-03  7:41       ` Glynn Clements
2004-06-03 11:32         ` Micha Feigin
2004-06-04  2:11           ` Glynn Clements
2004-06-04 12:31             ` Micha Feigin
2004-06-02 18:37     ` Jan-Benedict Glaw [this message]
2004-06-03  1:34       ` Micha Feigin
2004-06-03 19:42         ` Jan-Benedict Glaw
2004-06-03 23:44           ` Micha Feigin
2004-06-04  8:06             ` Jan-Benedict Glaw
2004-06-02 17:18 ` Glynn Clements
2004-06-03  1:28 ` Micha Feigin
2004-06-03  7:23   ` Luciano Moreira - igLnx
2004-06-03  7:59   ` Glynn Clements
2004-06-03 22:25     ` John T. Williams
2004-06-03 23:24       ` Paul Gimpelj
2004-06-04  0:14         ` John T. Williams
2004-06-04  2:35         ` Glynn Clements
2004-06-03 23:53       ` Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040602183734.GU20632@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).