Change structs use when freeing to avoid using index2size for large sizes.

1. Change the definition of emap_alloc_ctx_t
2. Change the read of both from edata_t.
3. Change the assignment and usage of emap_alloc_ctx_t.
4. Change other callsites of index2size.

Note for the changes in the data structure, i.e., emap_alloc_ctx_t,
will be used when the build-time config (--enable-limit-usize-gap) is
enabled but they will store the same value as index2size(szind) if the
runtime option (opt_limit_usize_gap) is not enabled.
This commit is contained in:
guangli-dai 2024-04-01 16:49:34 -07:00 committed by Guangli Dai
parent 96b15d5d43
commit d01d5b8f4a
9 changed files with 167 additions and 42 deletions

View file

@ -78,7 +78,8 @@ vsalloc(tsdn_t *tsdn, const void *ptr) {
return 0;
}
return sz_index2size(full_alloc_ctx.szind);
return config_limit_usize_gap? edata_usize_get(full_alloc_ctx.edata):
sz_index2size(full_alloc_ctx.szind);
}
static unsigned