Skip to content

Commit

Permalink
fix commited stat
Browse files Browse the repository at this point in the history
_mi_os_free reduces the stat by the full size. So we have to increase it by the uncommited sections beforehand.
  • Loading branch information
maxbachmann authored Aug 28, 2024
1 parent db3d848 commit c413f61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,9 @@ void _mi_arena_free(void* p, size_t size, size_t committed_size, mi_memid_t memi

if (mi_memkind_is_os(memid.memkind)) {
// was a direct OS allocation, pass through
if (!all_committed && committed_size > 0) {
// if partially committed, adjust the committed stats (as `_mi_os_free` will increase decommit by the full size)
_mi_stat_decrease(&_mi_stats_main.committed, committed_size);
if (!all_committed) {
// if partially committed, adjust the committed stats (as `_mi_os_free` reduce the stat by the full size)
_mi_stat_increase(&_mi_stats_main.committed, size - committed_size);
}
_mi_os_free(p, size, memid, stats);
}
Expand Down

0 comments on commit c413f61

Please sign in to comment.