[PATCH] Add a chunk_aligned_alloc function handling alignment constraints on chunks

Mike Hommey mh+jemalloc at glandium.org
Tue Apr 10 10:54:27 PDT 2012


On Tue, Apr 10, 2012 at 07:50:33PM +0200, Mike Hommey wrote:
> From: Mike Hommey <mh at glandium.org>
> 
> ---
>  include/jemalloc/internal/chunk.h      |   15 ++++++++++-
>  include/jemalloc/internal/chunk_dss.h  |    2 +-
>  include/jemalloc/internal/chunk_mmap.h |    2 +-
>  src/chunk.c                            |    7 ++---
>  src/chunk_dss.c                        |   46 +++++++++++++++++++-------------
>  src/chunk_mmap.c                       |   28 +++++++++----------
>  src/huge.c                             |   33 ++---------------------
>  7 files changed, 63 insertions(+), 70 deletions(-)

The reason why I'm interested in this is that the way VirtualAlloc and
VirtualFree work on Windows makes it cumbersome to do "huge" alignment,
and would require going through hoops and repeating code between huge.c
and chunk_mmap.c. It gets simpler if everything is handled in one place.

I'm not sure how to best stress test the changes in chunk_dss.c, so I'm
not sure it doesn't break in subtle ways. The changes in chunk_mmap.c
are much more straightforward.

Mike



More information about the jemalloc-discuss mailing list