From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-4.6 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id DDE4C1F601 for ; Fri, 2 Dec 2022 19:49:54 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=gotplt.org header.i=@gotplt.org header.b="hcGMb+Er"; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DE8953858C62 for ; Fri, 2 Dec 2022 19:49:53 +0000 (GMT) Received: from insect.birch.relay.mailchannels.net (insect.birch.relay.mailchannels.net [23.83.209.93]) by sourceware.org (Postfix) with ESMTPS id 339FD3858C74 for ; Fri, 2 Dec 2022 19:49:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 339FD3858C74 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 108553E0ED1; Fri, 2 Dec 2022 19:49:40 +0000 (UTC) Received: from pdx1-sub0-mail-a304.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 959D33E1CEA; Fri, 2 Dec 2022 19:49:39 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1670010579; a=rsa-sha256; cv=none; b=7npsa0LSSM3JHWnnGSmi1nAtjfR5NtcdluZM77AG/Uf84qQB/JKdsqg1pcPK9BVVZsK/tO TasV7q8FHzORgvhZNRfeCbSXqejug0S5qx0pMZeinFCf9nzUqQOcefsMOO1zsTedx22kze rpJPwoEFX3x4uJBJ1DdxwdEKLXKkHPv75s4pr0kKoIwWwOzVGrCBRJZlSJ0Hbqcm3Z1SPt 6ptYusjBRo1xz+WYru1M75A+ngwKPEHpadPRVQvdmLW0Fv8vDQoPaUSYRTSJ3Iyq7RXyR9 RCQNNKD2cKchydD/q7+TlTXfP2VhljeKen/eOjYOnKm0xoQISs4w17CDZSDvaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1670010579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uNwU4uROIw/M5scVxnWZSNcoaQrv650jf2k7HKBB5KM=; b=XVevvntC464Q5BrFtWj8rCa2VCD5Rt/8g4JALKodgsiCRqjaqg7U6WE7v4rfVPocJLfUJ8 Xm2D8ztxGl9GxGhkK87stRDm/xSIxn6tGtuo1ezfMp0kkEVfPx76J0irtRpzQUYEvXHMby Fzw8iTA7Ovbv4IrN70NQHNUzt8DJw8a4lcQyNJuPnPZLbDSph8WX6PjBwdMKiylxT++d+4 xRly6KfhOEu9Zzk19pS1wXPb74zgXjlbOe1kApiiJau6YKX3Hp3zoPjUwKzr3/uGZu32eD BKPyhTG5m9QuVhdtKAcPK9jee5A2YQ+kOmFeQFnzkCzFPCspEafqYhac4v2dlg== ARC-Authentication-Results: i=1; rspamd-84789cff4b-hjwvq; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Harbor-Print: 443a84893ad07b27_1670010579848_1166237024 X-MC-Loop-Signature: 1670010579848:816016869 X-MC-Ingress-Time: 1670010579848 Received: from pdx1-sub0-mail-a304.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.123.200.112 (trex/6.7.1); Fri, 02 Dec 2022 19:49:39 +0000 Received: from [192.168.0.182] (bras-base-toroon4834w-grc-23-76-68-24-147.dsl.bell.ca [76.68.24.147]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a304.dreamhost.com (Postfix) with ESMTPSA id 4NP3S26Xdkz2W; Fri, 2 Dec 2022 11:49:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1670010579; bh=uNwU4uROIw/M5scVxnWZSNcoaQrv650jf2k7HKBB5KM=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=hcGMb+ErRwGntdRjkhS+XpsoIs/ABmbYH+JeUPfjbcGm3Nc1Lpniar9Xa2/uNnzoU m2xRpGvuRLbb9+ZfFdsVTpVsObD/Q7kgNQH1y/8OehzUDKvvx//7tQJNIcXqGheIsU dnZLIijsj3gtMpDlhOjUz2Xnn/1iXXR4T6OFsDkDKOHMq+F9wbK22xxgW4aZq6oDWM 6UB1qEzqZ769GX0+hvo6qiBnioCNXla6x4a5pyMV2Z0uRjX+O/kOhaXzuVxnWveHOr Owlmt605TsIei1mq9tvhuq2rvM7h1u+0ms7FOosXHZPj7XPRvH5MTi4/KiTqYEPnjl 4Z/BfKPF3LtBg== Message-ID: Date: Fri, 2 Dec 2022 14:49:37 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [RFC] Supporting malloc_usable_size Content-Language: en-US To: DJ Delorie Cc: sam@gentoo.org, libc-alpha@sourceware.org References: From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 2022-12-02 14:16, DJ Delorie wrote: > The value returned by malloc_usable_size() may be greater than the > requested size of the allocation because of various internal > implementation details, none of which the programmer should rely on. > This function is intended to only be used for diagnostics and > statistics; writing to the excess memory without first calling > realloc() to resize the allocation is not supported. The returned > value is only valid at the time of the call; any other call to a > malloc family API may invalidate it. That sounds reasonable. I wonder if the last statement could be taken as a guarantee of validity up to a certain point (i.e. another call to a malloc family API); should that be simply "The returned value is only valid at the time of the call."? Thanks, Sid