mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-04 17:36:23 +03:00
Add alignment support to chunk_alloc().
This commit is contained in:
parent
c5851eaf6e
commit
eae269036c
9 changed files with 87 additions and 138 deletions
|
|
@ -27,19 +27,20 @@ size_t arena_maxclass; /* Max size class for arenas. */
|
|||
* advantage of them if they are returned.
|
||||
*/
|
||||
void *
|
||||
chunk_alloc(size_t size, bool base, bool *zero)
|
||||
chunk_alloc(size_t size, size_t alignment, bool base, bool *zero)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
assert(size != 0);
|
||||
assert((size & chunksize_mask) == 0);
|
||||
assert((alignment & chunksize_mask) == 0);
|
||||
|
||||
if (config_dss) {
|
||||
ret = chunk_alloc_dss(size, zero);
|
||||
ret = chunk_alloc_dss(size, alignment, zero);
|
||||
if (ret != NULL)
|
||||
goto RETURN;
|
||||
}
|
||||
ret = chunk_alloc_mmap(size);
|
||||
ret = chunk_alloc_mmap(size, alignment);
|
||||
if (ret != NULL) {
|
||||
*zero = true;
|
||||
goto RETURN;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue