public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	Florian Weimer <fweimer@redhat.com>
Cc: Zack Weinberg via Libc-alpha <libc-alpha@sourceware.org>,
	Zack Weinberg <zack@owlfolio.org>, DJ Delorie <dj@redhat.com>
Subject: Re: [RFC] Supporting malloc_usable_size
Date: Fri, 9 Dec 2022 10:42:59 -0500	[thread overview]
Message-ID: <32b3937b-9cc8-99e7-ec9b-0b1decc3669b@gotplt.org> (raw)
In-Reply-To: <f648dde2-88a6-21f5-7b8c-548368837317@linaro.org>

On 2022-12-07 11:54, Adhemerval Zanella Netto wrote:
> I tend to agree with full deprecation, systemd MALLOC_SIZEOF_SAFE is an
> example of what user needs to hack around with an ill defined interface and
> _FORTIFY_SOURCE=3 warning should be clear that keep it is not a gain in long
> term (besides adding even more trouble for portability).
> 
> Another possibility would to make malloc_usable_size always return the malloc
> size argument (although it would add some internal metadata costs).
> 

Do we want to go down this path?  I was quite reluctant until I 
remembered that there's P0401R6 for C++ that would need this kind of 
information for support anyway.  The intent of that paper is different, 
it's to optimize for realloc and that would actually need us to endorse 
the chunk size as the actual size when we return it.  That would then 
disallow chunks from being consolidated, thus making usable size 
consistent through the lifetime of the object.

Basically, it looks like one way or another, there's value in making the 
return value of malloc_usable_size consistent and maybe even usable for 
writes if we are to support something like P0401R6 in future and 
instead, help the compiler see this usable size.

Thoughts?

Thanks,
Siddhesh

[1] 
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0401r6.html#deallocate

  parent reply	other threads:[~2022-12-09 15:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 21:32 Siddhesh Poyarekar
2022-12-02  4:42 ` DJ Delorie
2022-12-02  5:00   ` Sam James
2022-12-02  5:28     ` DJ Delorie
2022-12-02 12:36       ` Siddhesh Poyarekar
2022-12-02 19:16         ` DJ Delorie
2022-12-02 19:49           ` Siddhesh Poyarekar
2022-12-02 19:57             ` DJ Delorie
2022-12-02 12:03 ` Andreas Schwab
2022-12-02 12:22   ` Siddhesh Poyarekar
2022-12-02 12:34     ` Andreas Schwab
2022-12-02 12:39       ` Florian Weimer
2022-12-05 18:46         ` Zack Weinberg
2022-12-05 19:04           ` Siddhesh Poyarekar
2022-12-05 20:35           ` Florian Weimer
2022-12-06 19:25             ` Siddhesh Poyarekar
2022-12-07 10:01               ` Florian Weimer
2022-12-07 16:34                 ` Siddhesh Poyarekar
2022-12-07 16:54                   ` Adhemerval Zanella Netto
2022-12-07 16:57                     ` Sam James
2022-12-07 17:39                     ` Florian Weimer
2022-12-09 15:42                     ` Siddhesh Poyarekar [this message]
2022-12-07 18:45                 ` DJ Delorie
2022-12-02 12:54     ` Florian Weimer
2022-12-02 13:54 Wilco Dijkstra

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=32b3937b-9cc8-99e7-ec9b-0b1decc3669b@gotplt.org \
    --to=siddhesh@gotplt.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=dj@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=zack@owlfolio.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).