mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
make max update in the stats atomic
This commit is contained in:
parent
529d74a282
commit
2e1b4f512d
2 changed files with 23 additions and 5 deletions
|
@ -27,7 +27,7 @@ static void mi_stat_update(mi_stat_count_t* stat, int64_t amount) {
|
|||
{
|
||||
// add atomically (for abandoned pages)
|
||||
mi_atomic_addi64(&stat->current,amount);
|
||||
if (stat->current > stat->peak) stat->peak = stat->current; // racing.. it's ok
|
||||
mi_atomic_maxi64(&stat->peak, stat->current);
|
||||
if (amount > 0) {
|
||||
mi_atomic_addi64(&stat->allocated,amount);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue