public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "siddhesh at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug malloc/30579] trim_threshold in realloc lead to high memory usage
Date: Thu, 22 Jun 2023 14:20:09 +0000	[thread overview]
Message-ID: <bug-30579-131-2lcHnJNb33@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30579-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30579

Siddhesh Poyarekar <siddhesh at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siddhesh at sourceware dot org

--- Comment #1 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
(In reply to Nicolas Dusart from comment #0)
> I'm not an expert but reusing trim_threshold as an heuristic to decide to
> reclaim memory or not does not seem a good fit for heap memory. 

That's the entire point of trim_threshold; to control fragmentation tolerance
for heap memory.

> By reading the comments, I would be tempted to set
> glibc.malloc.trim_threshold (via GLIBC_TUNABLES) to a value high enough for
> performance reason but now, we are somewhat forced to set it to a very low
> value to avoid consuming too much memory.

There are multiple ways to reach this kind of fragmentation I'm afraid and
setting trim threshold (and mmap_threshold for that matter) is the way to
customize the allocator to your specific needs.  There are other ways to
control trim threshold than tunables FWIW, e.g. by using mallopt() to move the
threshold around the way you need at any time in the program.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2023-06-22 14:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 13:54 [Bug malloc/30579] New: " nicolas at freedelity dot be
2023-06-22 14:20 ` siddhesh at sourceware dot org [this message]
2023-06-22 15:10 ` [Bug malloc/30579] " nicolas at freedelity dot be
2023-06-28  7:56 ` nicolas at freedelity dot be
2023-06-28 16:31 ` siddhesh at sourceware dot org
2023-07-06 15:38 ` cvs-commit at gcc dot gnu.org
2023-07-06 15:40 ` cvs-commit at gcc dot gnu.org
2023-07-06 15:42 ` siddhesh at sourceware dot org
2023-07-06 16:09 ` nicolas at freedelity dot be

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=bug-30579-131-2lcHnJNb33@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).