mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-07 11:58:41 +03:00
strengthen some atomic operations for weak memory models
This commit is contained in:
parent
2159c22415
commit
5c7c106d62
4 changed files with 53 additions and 34 deletions
|
@ -38,8 +38,8 @@ static void mi_stat_update(mi_stat_count_t* stat, int64_t amount) {
|
|||
if (mi_is_in_main(stat))
|
||||
{
|
||||
// add atomically (for abandoned pages)
|
||||
int64_t current = mi_atomic_add64(&stat->current,amount);
|
||||
if (current > stat->peak) stat->peak = stat->current; // racing.. it's ok
|
||||
mi_atomic_add64(&stat->current,amount);
|
||||
if (stat->current > stat->peak) stat->peak = stat->current; // racing.. it's ok
|
||||
if (amount > 0) {
|
||||
mi_atomic_add64(&stat->allocated,amount);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue