mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-14 22:51:50 +03:00
Fix a data race for large allocation stats counters.
Reported by Pat Lynch.
This commit is contained in:
parent
f1c3da8b02
commit
30e7cb1118
1 changed files with 4 additions and 1 deletions
|
|
@ -260,8 +260,8 @@ tcache_arena_dissociate(tcache_t *tcache)
|
|||
/* Unlink from list of extant tcaches. */
|
||||
malloc_mutex_lock(&tcache->arena->lock);
|
||||
ql_remove(&tcache->arena->tcache_ql, tcache, link);
|
||||
malloc_mutex_unlock(&tcache->arena->lock);
|
||||
tcache_stats_merge(tcache, tcache->arena);
|
||||
malloc_mutex_unlock(&tcache->arena->lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -399,11 +399,14 @@ tcache_thread_cleanup(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
/* Caller must own arena->lock. */
|
||||
void
|
||||
tcache_stats_merge(tcache_t *tcache, arena_t *arena)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
cassert(config_stats);
|
||||
|
||||
/* Merge and reset tcache stats. */
|
||||
for (i = 0; i < NBINS; i++) {
|
||||
arena_bin_t *bin = &arena->bins[i];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue