Invoke arena_dalloc_promoted() properly w/o tcache.

When tcache was disabled, the dalloc promoted case was missing.
This commit is contained in:
Qi Wang 2019-07-24 16:12:06 -07:00 committed by Qi Wang
parent 1d148f353a
commit bc0998a905
2 changed files with 13 additions and 5 deletions

View File

@ -228,6 +228,16 @@ arena_vsalloc(tsdn_t *tsdn, const void *ptr) {
return sz_index2size(szind); return sz_index2size(szind);
} }
static inline void
arena_dalloc_large_no_tcache(tsdn_t *tsdn, void *ptr, szind_t szind) {
if (config_prof && unlikely(szind < SC_NBINS)) {
arena_dalloc_promoted(tsdn, ptr, NULL, true);
} else {
extent_t *extent = iealloc(tsdn, ptr);
large_dalloc(tsdn, extent);
}
}
static inline void static inline void
arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) { arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) {
assert(ptr != NULL); assert(ptr != NULL);
@ -252,8 +262,7 @@ arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) {
/* Small allocation. */ /* Small allocation. */
arena_dalloc_small(tsdn, ptr); arena_dalloc_small(tsdn, ptr);
} else { } else {
extent_t *extent = iealloc(tsdn, ptr); arena_dalloc_large_no_tcache(tsdn, ptr, szind);
large_dalloc(tsdn, extent);
} }
} }
@ -349,8 +358,7 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_t size) {
/* Small allocation. */ /* Small allocation. */
arena_dalloc_small(tsdn, ptr); arena_dalloc_small(tsdn, ptr);
} else { } else {
extent_t *extent = iealloc(tsdn, ptr); arena_dalloc_large_no_tcache(tsdn, ptr, szind);
large_dalloc(tsdn, extent);
} }
} }

View File

@ -1610,7 +1610,7 @@ arena_dalloc_promoted(tsdn_t *tsdn, void *ptr, tcache_t *tcache,
assert(bumped_usize == SC_LARGE_MINCLASS); assert(bumped_usize == SC_LARGE_MINCLASS);
safety_check_verify_redzone(ptr, usize, bumped_usize); safety_check_verify_redzone(ptr, usize, bumped_usize);
} }
if (bumped_usize <= tcache_maxclass) { if (bumped_usize <= tcache_maxclass && tcache != NULL) {
tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr, tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr,
sz_size2index(bumped_usize), slow_path); sz_size2index(bumped_usize), slow_path);
} else { } else {