| #define JEMALLOC_CHUNK_C_ |
| #include "jemalloc/internal/jemalloc_internal.h" |
| |
| /******************************************************************************/ |
| /* Data. */ |
| |
| const char *opt_dss = DSS_DEFAULT; |
| size_t opt_lg_chunk = 0; |
| |
| /* Various chunk-related settings. */ |
| size_t chunksize; |
| size_t chunksize_mask; /* (chunksize - 1). */ |
| size_t chunk_npages; |
| |
| /******************************************************************************/ |
| |
| bool |
| chunk_boot(void) |
| { |
| #ifdef _WIN32 |
| SYSTEM_INFO info; |
| GetSystemInfo(&info); |
| |
| /* |
| * Verify actual page size is equal to or an integral multiple of |
| * configured page size. |
| */ |
| if (info.dwPageSize & ((1U << LG_PAGE) - 1)) |
| return (true); |
| |
| /* |
| * Configure chunksize (if not set) to match granularity (usually 64K), |
| * so pages_map will always take fast path. |
| */ |
| if (!opt_lg_chunk) { |
| opt_lg_chunk = ffs_u((unsigned)info.dwAllocationGranularity) |
| - 1; |
| } |
| #else |
| if (!opt_lg_chunk) |
| opt_lg_chunk = LG_CHUNK_DEFAULT; |
| #endif |
| |
| /* Set variables according to the value of opt_lg_chunk. */ |
| chunksize = (ZU(1) << opt_lg_chunk); |
| assert(chunksize >= PAGE); |
| chunksize_mask = chunksize - 1; |
| chunk_npages = (chunksize >> LG_PAGE); |
| |
| return (false); |
| } |