mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-13 15:35:37 +03:00
Convert the production source files in src/ (69 .c/.cpp) and test/jemalloc_test.h.in to list the headers they actually use, then delete the umbrella. Three consolidated headers (peak_event.h, prof_sys.h, sz.h) also gain explicit transitive includes. Every translation unit now declares what it uses. A missing include now fails at the failing file rather than silently working because something upstream pulled in the world.
30 lines
854 B
C
30 lines
854 B
C
#include "jemalloc/internal/jemalloc_preamble.h"
|
|
|
|
#include "jemalloc/internal/arena.h"
|
|
#include "jemalloc/internal/bin_info.h"
|
|
#include "jemalloc/internal/edata.h"
|
|
#include "jemalloc/internal/emap.h"
|
|
#include "jemalloc/internal/inspect.h"
|
|
|
|
void
|
|
inspect_extent_util_stats_get(
|
|
tsdn_t *tsdn, const void *ptr, size_t *nfree, size_t *nregs, size_t *size) {
|
|
assert(ptr != NULL && nfree != NULL && nregs != NULL && size != NULL);
|
|
|
|
const edata_t *edata = emap_edata_lookup(tsdn, &arena_emap_global, ptr);
|
|
if (unlikely(edata == NULL)) {
|
|
*nfree = *nregs = *size = 0;
|
|
return;
|
|
}
|
|
|
|
*size = edata_size_get(edata);
|
|
if (!edata_slab_get(edata)) {
|
|
*nfree = 0;
|
|
*nregs = 1;
|
|
} else {
|
|
*nfree = edata_nfree_get(edata);
|
|
*nregs = bin_infos[edata_szind_get(edata)].nregs;
|
|
assert(*nfree <= *nregs);
|
|
assert(*nfree * edata_usize_get(edata) <= *size);
|
|
}
|
|
}
|