On Jul 28, 2014, at 2:17 PM, meng <[email protected]> wrote:
> I used the new chunk allocator feature to allocate memory from a fixed 2G 
> memory region. Nevertheless, I got a seg. fault. 
> 
> The flow of my code is as following:  I first use "arenas.extend" mallctl to 
> create a custom arena. Then I defined custom chunk_alloc() and chunk_dalloc() 
> on this arena. In the initialization phase of my code, I use mmap() to 
> reserve a memory region of size 2^32. In the custom chunk_alloc(), I return 
> the pointer of the 2^32B memory region. Because lg_chunk is 2^22, I thought 
> this should be fine. But the program ran into seg. fault within  
> arena_mapbits_unzeroed_set() called by arena_chunk_init_hard().  On the other 
> hand, if the mmap() reserved a memory region of size 2^22, everything works 
> fine. 
> 
> My question is: why does the custom chunk_alloc() always expect a memory 
> block returned from mmap()/malloc() with the requested size equal to 
> lg_chunk? I can't figure out what wrong it could be if the returned block is 
> a multiple of lg_chunk
> 
> B.T.W. My code only uses mallocx() for a single 1024B buffer from the custom. 
> Memory alignment problem shouldn't exist.

Is the address you're returning from the custom chunk_alloc() aligned at a 
multiple of the chunk size?

Jason
_______________________________________________
jemalloc-discuss mailing list
[email protected]
http://www.canonware.com/mailman/listinfo/jemalloc-discuss

Reply via email to