[RFC] how to get the size of a malloc(9) block ?

Tim Kientzle kientzle at freebsd.org
Sat Nov 30 04:38:02 UTC 2013


On Nov 29, 2013, at 3:44 PM, jb <jb.1234abcd at gmail.com> wrote:

> Luigi Rizzo <rizzo <at> iet.unipi.it> writes:
> 
>> ... 
>> There is a difference between applications peeking into
>> implementation details that should be hidden, and providing
>> instead limited and specific information through a well defined API.
>> ...
> 
> Right.
> 
> If you want to improve memory management, that is, have the system (kernel
> or user space) handle memory reallocation intelligently and transparently
> to the user, then aim at a well defined API:

Don’t forget:

 * Request a block of “at least N bytes” and have the
allocator tell you what it *really* allocated.

This allows applications to use memory more efficiently
by taking advantage of over-allocation when it happens.

Tim



More information about the freebsd-current mailing list