@@ -113,7 +113,7 @@ CTL_PROTO(opt_prof_final)
113
113
CTL_PROTO (opt_prof_leak )
114
114
CTL_PROTO (opt_prof_accum )
115
115
CTL_PROTO (arena_i_purge )
116
- static int arena_purge (unsigned arena_ind );
116
+ static void arena_purge (unsigned arena_ind );
117
117
CTL_PROTO (arena_i_dss )
118
118
INDEX_PROTO (arena_i )
119
119
CTL_PROTO (arenas_bin_i_size )
@@ -1274,35 +1274,27 @@ CTL_RO_NL_CGEN(config_prof, opt_prof_accum, opt_prof_accum, bool)
1274
1274
1275
1275
/******************************************************************************/
1276
1276
1277
- static int
1277
+ /* ctl_mutex must be held during execution of this function. */
1278
+ static void
1278
1279
arena_purge (unsigned arena_ind )
1279
1280
{
1280
- int ret ;
1281
-
1282
- malloc_mutex_lock (& ctl_mtx );
1283
- {
1284
- VARIABLE_ARRAY (arena_t * , tarenas , ctl_stats .narenas );
1281
+ VARIABLE_ARRAY (arena_t * , tarenas , ctl_stats .narenas );
1285
1282
1286
- malloc_mutex_lock (& arenas_lock );
1287
- memcpy (tarenas , arenas , sizeof (arena_t * ) * ctl_stats .narenas );
1288
- malloc_mutex_unlock (& arenas_lock );
1283
+ malloc_mutex_lock (& arenas_lock );
1284
+ memcpy (tarenas , arenas , sizeof (arena_t * ) * ctl_stats .narenas );
1285
+ malloc_mutex_unlock (& arenas_lock );
1289
1286
1290
- if (arena_ind == ctl_stats .narenas ) {
1291
- unsigned i ;
1292
- for (i = 0 ; i < ctl_stats .narenas ; i ++ ) {
1293
- if (tarenas [i ] != NULL )
1294
- arena_purge_all (tarenas [i ]);
1295
- }
1296
- } else {
1297
- assert (arena_ind < ctl_stats .narenas );
1298
- if (tarenas [arena_ind ] != NULL )
1299
- arena_purge_all (tarenas [arena_ind ]);
1287
+ if (arena_ind == ctl_stats .narenas ) {
1288
+ unsigned i ;
1289
+ for (i = 0 ; i < ctl_stats .narenas ; i ++ ) {
1290
+ if (tarenas [i ] != NULL )
1291
+ arena_purge_all (tarenas [i ]);
1300
1292
}
1293
+ } else {
1294
+ assert (arena_ind < ctl_stats .narenas );
1295
+ if (tarenas [arena_ind ] != NULL )
1296
+ arena_purge_all (tarenas [arena_ind ]);
1301
1297
}
1302
-
1303
- ret = 0 ;
1304
- malloc_mutex_unlock (& ctl_mtx );
1305
- return (ret );
1306
1298
}
1307
1299
1308
1300
static int
@@ -1313,8 +1305,11 @@ arena_i_purge_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
1313
1305
1314
1306
READONLY ();
1315
1307
WRITEONLY ();
1316
- ret = arena_purge (mib [1 ]);
1308
+ malloc_mutex_lock (& ctl_mtx );
1309
+ arena_purge (mib [1 ]);
1310
+ malloc_mutex_unlock (& ctl_mtx );
1317
1311
1312
+ ret = 0 ;
1318
1313
label_return :
1319
1314
return (ret );
1320
1315
}
@@ -1483,7 +1478,8 @@ arenas_purge_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
1483
1478
else {
1484
1479
if (arena_ind == UINT_MAX )
1485
1480
arena_ind = ctl_stats .narenas ;
1486
- ret = arena_purge (arena_ind );
1481
+ arena_purge (arena_ind );
1482
+ ret = 0 ;
1487
1483
}
1488
1484
1489
1485
label_return :
0 commit comments