| 1652 | } |
| 1653 | |
| 1654 | JEMALLOC_ALWAYS_INLINE void * |
| 1655 | imalloc_sample(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd, |
| 1656 | size_t usize, szind_t ind) { |
| 1657 | void *ret; |
| 1658 | |
| 1659 | /* |
| 1660 | * For small allocations, sampling bumps the usize. If so, we allocate |
| 1661 | * from the ind_large bucket. |
| 1662 | */ |
| 1663 | szind_t ind_large; |
| 1664 | size_t bumped_usize = usize; |
| 1665 | |
| 1666 | if (usize <= SMALL_MAXCLASS) { |
| 1667 | assert(((dopts->alignment == 0) ? sz_s2u(LARGE_MINCLASS) : |
| 1668 | sz_sa2u(LARGE_MINCLASS, dopts->alignment)) |
| 1669 | == LARGE_MINCLASS); |
| 1670 | ind_large = sz_size2index(LARGE_MINCLASS); |
| 1671 | bumped_usize = sz_s2u(LARGE_MINCLASS); |
| 1672 | ret = imalloc_no_sample(sopts, dopts, tsd, bumped_usize, |
| 1673 | bumped_usize, ind_large); |
| 1674 | if (unlikely(ret == NULL)) { |
| 1675 | return NULL; |
| 1676 | } |
| 1677 | arena_prof_promote(tsd_tsdn(tsd), ret, usize); |
| 1678 | } else { |
| 1679 | ret = imalloc_no_sample(sopts, dopts, tsd, usize, usize, ind); |
| 1680 | } |
| 1681 | |
| 1682 | return ret; |
| 1683 | } |
| 1684 | |
| 1685 | /* |
| 1686 | * Returns true if the allocation will overflow, and false otherwise. Sets |
no test coverage detected