summaryrefslogtreecommitdiff
path: root/db/jsobj.cpp
diff options
context:
space:
mode:
authorAlberto Lerner <alerner@10gen.com>2010-07-20 13:44:35 -0400
committerAlberto Lerner <alerner@10gen.com>2010-07-20 13:44:35 -0400
commit9c33f219fb8bdc414089dff8c4dcbc8d65d0ee8f (patch)
treea4d99a132c78e626ea123f2ed09525aa796984ce /db/jsobj.cpp
parentd6249cdbd8bf46c0c3eafa13f47cde21fa0df67e (diff)
downloadmongo-9c33f219fb8bdc414089dff8c4dcbc8d65d0ee8f.tar.gz
SERVER-1272 Inline hot portion of BufBuild::grow()
Diffstat (limited to 'db/jsobj.cpp')
-rw-r--r--db/jsobj.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/db/jsobj.cpp b/db/jsobj.cpp
index 2d0c0e829dc..ed43ef604b9 100644
--- a/db/jsobj.cpp
+++ b/db/jsobj.cpp
@@ -1008,6 +1008,20 @@ namespace mongo {
eb.done();
}
+ /* BufBuilder --------------------------------------------------------*/
+
+ void BufBuilder::grow_reallocate() {
+ int a = size * 2;
+ if ( a == 0 )
+ a = 512;
+ if ( l > a )
+ a = l + 16 * 1024;
+ if( a > 64 * 1024 * 1024 )
+ msgasserted(10000, "BufBuilder grow() > 64MB");
+ data = (char *) realloc(data, a);
+ size= a;
+ }
+
/*-- test things ----------------------------------------------------*/
#pragma pack(1)