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

Jason Evans jasone at canonware.com
Tue Apr 10 14:59:03 PDT 2012


On Apr 10, 2012, at 10:54 AM, Mike Hommey wrote:
> 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.

There were problems in the dss code that I had to fix, and I did some other refactoring that this change allowed (e.g. huge_malloc() now just calls huge_palloc()).  The result is committed now; please let me know if you encounter any problems with the changes I made.

By the way, I'm excited to see hints of Windows support in the works. =)

Thanks,
Jason


More information about the jemalloc-discuss mailing list