diff options
author | Alberto Lerner <alerner@10gen.com> | 2010-07-20 13:44:35 -0400 |
---|---|---|
committer | Alberto Lerner <alerner@10gen.com> | 2010-07-20 13:44:35 -0400 |
commit | 9c33f219fb8bdc414089dff8c4dcbc8d65d0ee8f (patch) | |
tree | a4d99a132c78e626ea123f2ed09525aa796984ce /db | |
parent | d6249cdbd8bf46c0c3eafa13f47cde21fa0df67e (diff) | |
download | mongo-9c33f219fb8bdc414089dff8c4dcbc8d65d0ee8f.tar.gz |
SERVER-1272 Inline hot portion of BufBuild::grow()
Diffstat (limited to 'db')
-rw-r--r-- | db/jsobj.cpp | 14 |
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) |