* Allocate an extent that is at least as large as specified size, with * specified alignment. */
| 198 | * specified alignment. |
| 199 | */ |
| 200 | static extent_t * |
| 201 | base_extent_alloc(tsdn_t *tsdn, base_t *base, size_t size, size_t alignment) { |
| 202 | malloc_mutex_assert_owner(tsdn, &base->mtx); |
| 203 | |
| 204 | extent_hooks_t *extent_hooks = base_extent_hooks_get(base); |
| 205 | /* |
| 206 | * Drop mutex during base_block_alloc(), because an extent hook will be |
| 207 | * called. |
| 208 | */ |
| 209 | malloc_mutex_unlock(tsdn, &base->mtx); |
| 210 | base_block_t *block = base_block_alloc(extent_hooks, base_ind_get(base), |
| 211 | &base->pind_last, &base->extent_sn_next, size, alignment); |
| 212 | malloc_mutex_lock(tsdn, &base->mtx); |
| 213 | if (block == NULL) { |
| 214 | return NULL; |
| 215 | } |
| 216 | block->next = base->blocks; |
| 217 | base->blocks = block; |
| 218 | if (config_stats) { |
| 219 | base->allocated += sizeof(base_block_t); |
| 220 | base->resident += PAGE_CEILING(sizeof(base_block_t)); |
| 221 | base->mapped += block->size; |
| 222 | assert(base->allocated <= base->resident); |
| 223 | assert(base->resident <= base->mapped); |
| 224 | } |
| 225 | return &block->extent; |
| 226 | } |
| 227 | |
| 228 | base_t * |
| 229 | b0get(void) { |
no test coverage detected