summaryrefslogtreecommitdiff
path: root/cppe
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-03-07 18:51:01 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-03-07 18:51:01 +0000
commitdbf4b8239f2ace554418b5de09141eff27a19bb7 (patch)
treeb7d97a33283b0fab5f0f0467cba4a7291de4d5b7 /cppe
parentModified comment (diff)
downloadice-dbf4b8239f2ace554418b5de09141eff27a19bb7.tar.bz2
ice-dbf4b8239f2ace554418b5de09141eff27a19bb7.tar.xz
ice-dbf4b8239f2ace554418b5de09141eff27a19bb7.zip
Added shrinkCounter
Diffstat (limited to 'cppe')
-rw-r--r--cppe/include/IceE/Buffer.h11
-rw-r--r--cppe/src/IceE/Buffer.cpp1
2 files changed, 11 insertions, 1 deletions
diff --git a/cppe/include/IceE/Buffer.h b/cppe/include/IceE/Buffer.h
index 5cf1a7fcfd5..37f98a6a905 100644
--- a/cppe/include/IceE/Buffer.h
+++ b/cppe/include/IceE/Buffer.h
@@ -129,7 +129,15 @@ public:
// current size. This is to avoid holding on too much
// memory if it's not needed anymore.
//
- reserve(_size);
+ if(++_shrinkCounter > 2)
+ {
+ reserve(_size);
+ _shrinkCounter = 0;
+ }
+ }
+ else
+ {
+ _shrinkCounter = 0;
}
_size = 0;
}
@@ -161,6 +169,7 @@ public:
pointer _buf;
size_type _size;
size_type _capacity;
+ int _shrinkCounter;
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
//
diff --git a/cppe/src/IceE/Buffer.cpp b/cppe/src/IceE/Buffer.cpp
index ae7563a7aa5..c6b758b3a5b 100644
--- a/cppe/src/IceE/Buffer.cpp
+++ b/cppe/src/IceE/Buffer.cpp
@@ -68,6 +68,7 @@ IceInternal::Buffer::Container::swap(Container& other)
std::swap(_size, other._size);
std::swap(_capacity, other._capacity);
+ std::swap(_shrinkCounter, other._shrinkCounter);
}
void