MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / large_ralloc_no_move_shrink

Function large_ralloc_no_move_shrink

deps/jemalloc/src/large.c:95–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93 large_dalloc_maybe_junk_impl;
94
95static bool
96large_ralloc_no_move_shrink(tsdn_t *tsdn, extent_t *extent, size_t usize) {
97 arena_t *arena = extent_arena_get(extent);
98 size_t oldusize = extent_usize_get(extent);
99 extent_hooks_t *extent_hooks = extent_hooks_get(arena);
100 size_t diff = extent_size_get(extent) - (usize + sz_large_pad);
101
102 assert(oldusize > usize);
103
104 if (extent_hooks->split == NULL) {
105 return true;
106 }
107
108 /* Split excess pages. */
109 if (diff != 0) {
110 extent_t *trail = extent_split_wrapper(tsdn, arena,
111 &extent_hooks, extent, usize + sz_large_pad,
112 sz_size2index(usize), false, diff, SC_NSIZES, false);
113 if (trail == NULL) {
114 return true;
115 }
116
117 if (config_fill && unlikely(opt_junk_free)) {
118 large_dalloc_maybe_junk(extent_addr_get(trail),
119 extent_size_get(trail));
120 }
121
122 arena_extents_dirty_dalloc(tsdn, arena, &extent_hooks, trail);
123 }
124
125 arena_extent_ralloc_large_shrink(tsdn, arena, extent, oldusize);
126
127 return false;
128}
129
130static bool
131large_ralloc_no_move_expand(tsdn_t *tsdn, extent_t *extent, size_t usize,

Callers 1

large_ralloc_no_moveFunction · 0.70

Calls 9

extent_hooks_getFunction · 0.70
extent_split_wrapperFunction · 0.70
extent_arena_getFunction · 0.50
extent_usize_getFunction · 0.50
extent_size_getFunction · 0.50
sz_size2indexFunction · 0.50
extent_addr_getFunction · 0.50

Tested by

no test coverage detected