Proposed addition of malloc_size_np()

Vasil Dimov vd at FreeBSD.org
Tue Mar 28 05:24:23 UTC 2006


On Mon, Mar 27, 2006 at 08:34:41AM -0800, Jason Evans wrote:
[...]
> Following is what I've written for the malloc(3) man page:
> ----
> The malloc_usable_size() function returns the usable size of the 
> allocation pointed to by ptr.  The return value may be larger than the 
> size that was requested during allocation.  malloc_usable_size() is not 
> intended as a mechanism for in-place realloc(), though it can be abused 
> that way; rather it is primarily provided as a tool for introspection 
> purposes.  Any discrepancy between the requested allocation size and the 
> size reported by malloc_usable_size() should not be depended on, since 
> such behavior is entirely implementation-dependent.
> ----
Although this is obvious it should mention that the pointer passed must
have been returned by a malloc() or realloc() call or unpredictable
things will happen, right?

-- 
Vasil Dimov
gro.DSBeerF at dv

Testing can show the presence of bugs, but not their absence.
                -- Edsger W. Dijkstra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 155 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20060328/da56bffa/attachment.pgp


More information about the freebsd-arch mailing list