From owner-freebsd-arch@FreeBSD.ORG Mon Mar 27 16:09:47 2006 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75D9316A424; Mon, 27 Mar 2006 16:09:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id BE87643D46; Mon, 27 Mar 2006 16:09:46 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k2RG9X4e061929; Mon, 27 Mar 2006 11:09:38 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-arch@freebsd.org Date: Mon, 27 Mar 2006 11:10:00 -0500 User-Agent: KMail/1.9.1 References: <44247DF1.8000002@FreeBSD.org> <20060326110929.V35431@fledge.watson.org> <4426D7A0.4040007@FreeBSD.org> In-Reply-To: <4426D7A0.4040007@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603271110.02917.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1357/Sat Mar 25 16:37:38 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-3.8 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: John-Mark Gurney , Robert Watson , Jason Evans Subject: Re: Proposed addition of malloc_size_np() X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2006 16:09:47 -0000 On Sunday 26 March 2006 13:04, Jason Evans wrote: > Robert Watson wrote: > > I wonder if the intuitive objection people are raising is actually with > > the name. Since malloc_size() is defined on at least one platform to > > return the requested size, maybe a name like malloc_allocated_size() (or > > something a bit more compact) would help avoid that confusion, and make > > it clear that the consumer is getting back a commitment and not a hint > > for future realloc(), etc. > > Maybe you're right. We could just call it malloc_usable_size() and be > compatible with Linux. It would help to know why such a function would be useful. :) Do you have a specific use-case? If the purpose is for a program to see that it really as Y >= X bytes when it did malloc(X) so that the program can use Y bytes, that would seem to only be a source of bugs and complexity. If the program wants Y bytes, it should malloc(Y). Many folks in the thread seem to think that this function would be used for a poor-man's realloc() wrapper or something, and I think such uses would be short-sighted at best. If there are other uses such as for having a debug malloc wrap the real one, then that might justify the API, but it is unclear what a useful use of this API would be. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org