2017-01-20 13:41:41 +08:00
|
|
|
#define JEMALLOC_EXTENT_MMAP_C_
|
2017-04-11 09:17:55 +08:00
|
|
|
#include "jemalloc/internal/jemalloc_preamble.h"
|
|
|
|
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
2010-01-24 18:53:40 +08:00
|
|
|
|
2017-04-12 05:43:12 +08:00
|
|
|
#include "jemalloc/internal/assert.h"
|
|
|
|
|
2010-01-24 18:53:40 +08:00
|
|
|
/******************************************************************************/
|
2012-04-19 00:29:43 +08:00
|
|
|
|
2012-04-12 09:13:45 +08:00
|
|
|
void *
|
2016-06-02 03:59:02 +08:00
|
|
|
extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero,
|
2017-01-16 08:56:30 +08:00
|
|
|
bool *commit) {
|
2017-04-17 07:23:32 +08:00
|
|
|
void *ret = pages_map(new_addr, size, ALIGNMENT_CEILING(alignment,
|
|
|
|
PAGE), commit);
|
|
|
|
if (ret == NULL) {
|
|
|
|
return NULL;
|
2012-04-22 10:17:21 +08:00
|
|
|
}
|
2012-04-22 04:33:48 +08:00
|
|
|
assert(ret != NULL);
|
|
|
|
*zero = true;
|
2017-01-20 10:15:45 +08:00
|
|
|
return ret;
|
2010-01-24 18:53:40 +08:00
|
|
|
}
|
|
|
|
|
2012-04-13 11:20:58 +08:00
|
|
|
bool
|
2017-01-16 08:56:30 +08:00
|
|
|
extent_dalloc_mmap(void *addr, size_t size) {
|
|
|
|
if (config_munmap) {
|
2016-06-02 03:59:02 +08:00
|
|
|
pages_unmap(addr, size);
|
2017-01-16 08:56:30 +08:00
|
|
|
}
|
2017-01-20 10:15:45 +08:00
|
|
|
return !config_munmap;
|
2010-01-24 18:53:40 +08:00
|
|
|
}
|