linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glynn Clements <glynn.clements@virgin.net>
To: Marius Nita <marius@cs.pdx.edu>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: gc
Date: Sat, 23 Nov 2002 05:32:13 +0000	[thread overview]
Message-ID: <15839.4829.914097.752437@cerise.nosuchdomain.co.uk> (raw)
In-Reply-To: <20021122215432.GA13869@cs.pdx.edu>


Marius Nita wrote:

> i was wondering if anyone here has had any experience with the Boehm garbage
> collector (libgc).
> 
> i noticed that while it does seem to collect memory correctly, the
> reclaimed space is not shown by tools like ps and top. in a program, when you
> call free(), system memory is automatically adjusted. (as shown by these
> tools.)

Calling free() won't normally reduce the process' memory usage, which
is what ps/top/etc report.

The only situation where free() will actually return memory to the
system is if malloc() allocated a block of memory using anonymous
mmap() (rather than sbrk()), and the entire block is now unused. 
However, this situation seldom happens in real programs.

If you disable the use of anonymous mmap with mallopt(M_MMAP_MAX, 0),
malloc() will always use sbrk(), so free() would never reduce the
process size.

Aside: one consequence of using anonymous mmap() is that malloc() can
allocate memory which isn't included in the data segment resource
limit (setrlimit(RLIMIT_DATA, ...)).

-- 
Glynn Clements <glynn.clements@virgin.net>

      reply	other threads:[~2002-11-23  5:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-22 21:54 gc Marius Nita
2002-11-23  5:32 ` Glynn Clements [this message]

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=15839.4829.914097.752437@cerise.nosuchdomain.co.uk \
    --to=glynn.clements@virgin.net \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=marius@cs.pdx.edu \
    /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).