| 1951 | } |
| 1952 | |
| 1953 | JEMALLOC_ALWAYS_INLINE void * |
| 1954 | imalloc_sample(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd, |
| 1955 | size_t usize, szind_t ind) { |
| 1956 | void *ret; |
| 1957 | |
| 1958 | /* |
| 1959 | * For small allocations, sampling bumps the usize. If so, we allocate |
| 1960 | * from the ind_large bucket. |
| 1961 | */ |
| 1962 | szind_t ind_large; |
| 1963 | size_t bumped_usize = usize; |
| 1964 | |
| 1965 | if (usize <= SC_SMALL_MAXCLASS) { |
| 1966 | assert(((dopts->alignment == 0) ? |
| 1967 | sz_s2u(SC_LARGE_MINCLASS) : |
| 1968 | sz_sa2u(SC_LARGE_MINCLASS, dopts->alignment)) |
| 1969 | == SC_LARGE_MINCLASS); |
| 1970 | ind_large = sz_size2index(SC_LARGE_MINCLASS); |
| 1971 | bumped_usize = sz_s2u(SC_LARGE_MINCLASS); |
| 1972 | ret = imalloc_no_sample(sopts, dopts, tsd, bumped_usize, |
| 1973 | bumped_usize, ind_large); |
| 1974 | if (unlikely(ret == NULL)) { |
| 1975 | return NULL; |
| 1976 | } |
| 1977 | arena_prof_promote(tsd_tsdn(tsd), ret, usize); |
| 1978 | } else { |
| 1979 | ret = imalloc_no_sample(sopts, dopts, tsd, usize, usize, ind); |
| 1980 | } |
| 1981 | |
| 1982 | return ret; |
| 1983 | } |
| 1984 | |
| 1985 | /* |
| 1986 | * Returns true if the allocation will overflow, and false otherwise. Sets |
no test coverage detected