diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2013-03-18 23:49:48 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2013-03-18 23:49:48 +1100 |
commit | 07092e75d62d811699a505820105bec897bce7d0 (patch) | |
tree | 60c9603abccf8b7fc5d95b2a63bfcd40848416e5 /src | |
parent | 78ec0e75225bc963a0d6eee552284320bce3b1e9 (diff) | |
download | mongo-07092e75d62d811699a505820105bec897bce7d0.tar.gz |
Add an estimate of per-allocation overhead.
Diffstat (limited to 'src')
-rw-r--r-- | src/include/btree.i | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/btree.i b/src/include/btree.i index 52769d837dc..8826a88ba0d 100644 --- a/src/include/btree.i +++ b/src/include/btree.i @@ -41,6 +41,14 @@ __wt_eviction_page_force(WT_SESSION_IMPL *session, WT_PAGE *page) } /* + * Estimate the per-allocation overhead. All allocators have some kind of + * header and pad for alignment. We can't know for sure what that adds up + * to, but this is an estimate based on some measurements of heap size versus + * bytes in use. + */ +#define WT_ALLOC_OVERHEAD 32 + +/* * __wt_cache_page_inmem_incr -- * Increment a page's memory footprint in the cache. */ @@ -49,6 +57,8 @@ __wt_cache_page_inmem_incr(WT_SESSION_IMPL *session, WT_PAGE *page, size_t size) { WT_CACHE *cache; + size += WT_ALLOC_OVERHEAD; + cache = S2C(session)->cache; (void)WT_ATOMIC_ADD(cache->bytes_inmem, size); (void)WT_ATOMIC_ADD(page->memory_footprint, WT_STORE_SIZE(size)); @@ -65,6 +75,8 @@ __wt_cache_page_inmem_decr(WT_SESSION_IMPL *session, WT_PAGE *page, size_t size) { WT_CACHE *cache; + size += WT_ALLOC_OVERHEAD; + cache = S2C(session)->cache; (void)WT_ATOMIC_SUB(cache->bytes_inmem, size); (void)WT_ATOMIC_SUB(page->memory_footprint, WT_STORE_SIZE(size)); |