public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@redhat.com>
To: Konstantin Kharlamov <hi-angel@yandex.ru>,
	Christian Hoff <christian_hoff@gmx.net>,
	libc-help@sourceware.org
Subject: Re: Excessive memory consumption when using malloc()
Date: Thu, 25 Nov 2021 13:21:25 -0500	[thread overview]
Message-ID: <c20fabf9-3eb1-3f06-47a3-20da3ddc8e25@redhat.com> (raw)
In-Reply-To: <56522c8f847ddd27fdffedecb516f778837f9e92.camel@yandex.ru>

On 11/25/21 13:12, Konstantin Kharlamov via Libc-help wrote:
> So there you go, you 10G of unreleased memory is a Glibc feature, no complaints
> ;-P

Freeing memory back to the OS is a form of cache invalidation, and cache
invalidation is hard and workload dependent.

In this specific case, particularly with 50MiB, you are within the 64MiB
64-bit process heap size, and the 1024-byte frees do not trigger the
performance expensive consolidation and heap reduction (which requires
a munmap syscall to release the resources).

In the case of 10GiB, and 512KiB allocations, we are talking different
behaviour. I have responded here with my recommendations:
https://sourceware.org/pipermail/libc-help/2021-November/006052.html

-- 
Cheers,
Carlos.


  reply	other threads:[~2021-11-25 18:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25 17:20 Christian Hoff
2021-11-25 17:46 ` Konstantin Kharlamov
2021-11-25 18:12   ` Konstantin Kharlamov
2021-11-25 18:21     ` Carlos O'Donell [this message]
2021-11-25 20:56       ` Adhemerval Zanella
2021-11-26 18:10         ` Christian Hoff
2021-11-29 17:06           ` Patrick McGehearty
2021-11-25 18:20 ` Carlos O'Donell
2021-11-26 17:58   ` Christian Hoff
2021-11-29 19:44     ` Christian Hoff

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=c20fabf9-3eb1-3f06-47a3-20da3ddc8e25@redhat.com \
    --to=carlos@redhat.com \
    --cc=christian_hoff@gmx.net \
    --cc=hi-angel@yandex.ru \
    --cc=libc-help@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).