summaryrefslogtreecommitdiffstats
path: root/src/large.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-02-13 18:35:41 (GMT)
committerJason Evans <jasone@canonware.com>2017-02-16 23:52:11 (GMT)
commitb0654b95ed784be609c5212bd34f8141bdf5caca (patch)
treed4adca54fb4368dc51cbf7251194936ece73012e /src/large.c
parentf8fee6908d554aaa4f356bfcf7642bc7707eb6df (diff)
downloadjemalloc-b0654b95ed784be609c5212bd34f8141bdf5caca.zip
jemalloc-b0654b95ed784be609c5212bd34f8141bdf5caca.tar.gz
jemalloc-b0654b95ed784be609c5212bd34f8141bdf5caca.tar.bz2
Fix arena->stats.mapped accounting.
Mapped memory increases when extent_alloc_wrapper() succeeds, and decreases when extent_dalloc_wrapper() is called (during purging).
Diffstat (limited to 'src/large.c')
-rw-r--r--src/large.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/large.c b/src/large.c
index 55e0737..bb63849 100644
--- a/src/large.c
+++ b/src/large.c
@@ -147,6 +147,7 @@ large_ralloc_no_move_expand(tsdn_t *tsdn, extent_t *extent, size_t usize,
bool is_zeroed_trail = false;
bool commit = true;
extent_t *trail;
+ bool new_mapping;
if ((trail = extent_alloc_cache(tsdn, arena, &extent_hooks,
extent_past_get(extent), trailsize, 0, CACHELINE, &is_zeroed_trail,
&commit, false)) == NULL) {
@@ -155,6 +156,13 @@ large_ralloc_no_move_expand(tsdn_t *tsdn, extent_t *extent, size_t usize,
&is_zeroed_trail, &commit, false)) == NULL) {
return true;
}
+ if (config_stats) {
+ new_mapping = true;
+ }
+ } else {
+ if (config_stats) {
+ new_mapping = false;
+ }
}
if (extent_merge_wrapper(tsdn, arena, &extent_hooks, extent, trail)) {
@@ -162,6 +170,10 @@ large_ralloc_no_move_expand(tsdn_t *tsdn, extent_t *extent, size_t usize,
return true;
}
+ if (config_stats && new_mapping) {
+ arena_stats_mapped_add(tsdn, &arena->stats, trailsize);
+ }
+
if (zero || (config_fill && unlikely(opt_zero))) {
if (config_cache_oblivious) {
/*