@@ -23,6 +23,15 @@ huge_node_set(tsdn_t *tsdn, const void *ptr, extent_node_t *node)
2323 return (chunk_register (tsdn , ptr , node ));
2424}
2525
26+ static void
27+ huge_node_reset (tsdn_t * tsdn , const void * ptr , extent_node_t * node )
28+ {
29+ bool err ;
30+
31+ err = huge_node_set (tsdn , ptr , node );
32+ assert (!err );
33+ }
34+
2635static void
2736huge_node_unset (const void * ptr , const extent_node_t * node )
2837{
@@ -162,8 +171,10 @@ huge_ralloc_no_move_similar(tsdn_t *tsdn, void *ptr, size_t oldsize,
162171
163172 malloc_mutex_lock (tsdn , & arena -> huge_mtx );
164173 /* Update the size of the huge allocation. */
174+ huge_node_unset (ptr , node );
165175 assert (extent_node_size_get (node ) != usize );
166176 extent_node_size_set (node , usize );
177+ huge_node_reset (tsdn , ptr , node );
167178 /* Update zeroed. */
168179 extent_node_zeroed_set (node , post_zeroed );
169180 malloc_mutex_unlock (tsdn , & arena -> huge_mtx );
@@ -224,7 +235,9 @@ huge_ralloc_no_move_shrink(tsdn_t *tsdn, void *ptr, size_t oldsize,
224235
225236 malloc_mutex_lock (tsdn , & arena -> huge_mtx );
226237 /* Update the size of the huge allocation. */
238+ huge_node_unset (ptr , node );
227239 extent_node_size_set (node , usize );
240+ huge_node_reset (tsdn , ptr , node );
228241 /* Update zeroed. */
229242 extent_node_zeroed_set (node , post_zeroed );
230243 malloc_mutex_unlock (tsdn , & arena -> huge_mtx );
@@ -260,7 +273,9 @@ huge_ralloc_no_move_expand(tsdn_t *tsdn, void *ptr, size_t oldsize,
260273
261274 malloc_mutex_lock (tsdn , & arena -> huge_mtx );
262275 /* Update the size of the huge allocation. */
276+ huge_node_unset (ptr , node );
263277 extent_node_size_set (node , usize );
278+ huge_node_reset (tsdn , ptr , node );
264279 malloc_mutex_unlock (tsdn , & arena -> huge_mtx );
265280
266281 if (zero || (config_fill && unlikely (opt_zero ))) {
0 commit comments