public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug malloc/30625] Moving "free(buf)" slows down code x1.6
Date: Tue, 11 Jul 2023 07:37:41 +0000	[thread overview]
Message-ID: <bug-30625-131-tv1R7cfPAc@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30625-131@http.sourceware.org/bugzilla/>

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
              Flags|                            |security-

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
The bad placement results in many brk calls (about three per loop iteration).
It's still present in the current sources.

The trimming heuristics are not unreasonable in this case, given how large the
BUF_SIZE allocation is. What you call “good placement” prevents heap trimming;
others have complained that we don't release memory in the middle of the heap
to the operating system, and they would call this “bad placement”.

We just don't know if the program will go to sleep after the free call, or
enter some longer computation not calling malloc/free, so if free detects that
there is a certain amount of memory that could be returned to the kernel, it
does that.

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

  reply	other threads:[~2023-07-11  7:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 13:01 [Bug malloc/30625] New: " safinaskar at mail dot ru
2023-07-11  7:37 ` fweimer at redhat dot com [this message]
2023-07-11 11:21 ` [Bug malloc/30625] " safinaskar at mail dot ru
2023-07-11 12:15 ` fweimer at redhat dot com
2024-01-14 18:58 ` sam at gentoo dot org

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-30625-131-tv1R7cfPAc@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).