diff options
author | Matt Kangas <matt.kangas@mongodb.com> | 2015-01-06 08:58:01 -0500 |
---|---|---|
committer | Matt Kangas <matt.kangas@mongodb.com> | 2015-01-06 08:58:01 -0500 |
commit | f9bdad71e16409017df02058d2579cf659ef2e44 (patch) | |
tree | bea79aa5d70bcdb81b1a0be6d7fefdbe249552ef /src/third_party/wiredtiger/src/include/buf.i | |
parent | 3ec53687da4702d348f1b55eda5e01bd26f36c4b (diff) | |
download | mongo-f9bdad71e16409017df02058d2579cf659ef2e44.tar.gz |
Import wiredtiger-wiredtiger-2.5.0-36-g94ac478.tar.gz from wiredtiger branch mongodb-2.8
Diffstat (limited to 'src/third_party/wiredtiger/src/include/buf.i')
-rw-r--r-- | src/third_party/wiredtiger/src/include/buf.i | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/src/include/buf.i b/src/third_party/wiredtiger/src/include/buf.i index 09bee9ff831..b8849396f01 100644 --- a/src/third_party/wiredtiger/src/include/buf.i +++ b/src/third_party/wiredtiger/src/include/buf.i @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2014-2015 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -119,13 +120,20 @@ __wt_buf_free(WT_SESSION_IMPL *session, WT_ITEM *buf) * Release a scratch buffer. */ static inline void -__wt_scr_free(WT_ITEM **bufp) +__wt_scr_free(WT_SESSION_IMPL *session, WT_ITEM **bufp) { WT_ITEM *buf; if ((buf = *bufp) != NULL) { *bufp = NULL; + if (session->scratch_cached + buf->memsize >= + S2C(session)->session_scratch_max) { + __wt_free(session, buf->mem); + buf->memsize = 0; + } else + session->scratch_cached += buf->memsize; + buf->data = NULL; buf->size = 0; F_CLR(buf, WT_ITEM_INUSE); |