[PATCH] Add a malloc_usable_size_in_advance function

Mike Hommey mh+jemalloc at glandium.org
Thu Feb 23 11:23:21 PST 2012


On Tue, Feb 21, 2012 at 05:39:10PM +0100, Mike Hommey wrote:
> From: Mike Hommey <mh at glandium.org>
> 
> ---
>  JEMALLOC_ATTR(visibility("default"))
> +size_t
> +JEMALLOC_P(malloc_usable_size_in_advance)(size_t size, size_t alignment)
> +{
> +	return (alignment == 0) ? s2u(size) : sa2u(size, alignment, NULL);
> +}

Both this and the "Use s2u in zone_good_size" patch don't work as
expected.

Please note that the "Allow to use different prefixes for
jemalloc-specific functions and libc functions" patch depends on "Use
s2u in zone_good_size" (since the latter removes calls to
JEMALLOC_P(malloc|free) which the former thus doesn't change.

Cheers,

Mike



More information about the jemalloc-discuss mailing list