Create a const array with only a small bin to size map

This commit is contained in:
Ben Maurer
2014-04-16 14:31:24 -07:00
parent 6c39f9e059
commit 021136ce4d
5 changed files with 17 additions and 7 deletions

View File

@@ -266,14 +266,14 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero)
binind = SMALL_SIZE2BIN(size);
assert(binind < NBINS);
tbin = &tcache->tbins[binind];
size = arena_bin_info[binind].reg_size;
size = small_bin2size[binind];
ret = tcache_alloc_easy(tbin);
if (ret == NULL) {
ret = tcache_alloc_small_hard(tcache, tbin, binind);
if (ret == NULL)
return (NULL);
}
assert(tcache_salloc(ret) == arena_bin_info[binind].reg_size);
assert(tcache_salloc(ret) == size);
if (zero == false) {
if (config_fill) {
@@ -296,7 +296,7 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero)
if (config_stats)
tbin->tstats.nrequests++;
if (config_prof)
tcache->prof_accumbytes += arena_bin_info[binind].reg_size;
tcache->prof_accumbytes += size;
tcache_event(tcache);
return (ret);
}