diff options
author | Marc Laukien <marc@zeroc.com> | 2005-03-06 20:09:43 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2005-03-06 20:09:43 +0000 |
commit | def61b8d87e0a189ac60e3f724974791f14ef714 (patch) | |
tree | 635582b93bd10aa805cd0615a26f59b92b0f3456 /cpp | |
parent | Fixed deadly Sun CC 5.5 bug (diff) | |
download | ice-def61b8d87e0a189ac60e3f724974791f14ef714.tar.bz2 ice-def61b8d87e0a189ac60e3f724974791f14ef714.tar.xz ice-def61b8d87e0a189ac60e3f724974791f14ef714.zip |
removed MemoryPool.cpp
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/include/IceUtil/MemoryPool.h | 56 | ||||
-rw-r--r-- | cpp/src/IceUtil/Makefile | 1 | ||||
-rwxr-xr-x | cpp/src/IceUtil/MemoryPool.cpp | 119 | ||||
-rw-r--r-- | cpp/src/IceUtil/iceutil.dsp | 8 |
4 files changed, 0 insertions, 184 deletions
diff --git a/cpp/include/IceUtil/MemoryPool.h b/cpp/include/IceUtil/MemoryPool.h deleted file mode 100755 index e820b9fefc7..00000000000 --- a/cpp/include/IceUtil/MemoryPool.h +++ /dev/null @@ -1,56 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** -
-#ifndef UTIL_MEMORY_POOL_H
-#define UTIL_MEMORY_POOL_H
-
-#include <IceUtil/Mutex.h>
-
-namespace IceUtil
-{
-
-class ICE_UTIL_API SimpleMemoryPool
-{
-public:
-
- SimpleMemoryPool(const char*, int);
-
- void* operatorNew(size_t);
- void operatorDelete(void*);
-
- static void usePool(bool);
- static void traceLevel(int);
-
-protected:
-
- static bool _usePool;
-
-private:
-
- const char* _name;
- const int _num;
-
- void* _pool;
-
- static int _traceLevel;
-};
-
-class ICE_UTIL_API MemoryPool : public SimpleMemoryPool, IceUtil::Mutex
-{
-public:
-
- MemoryPool(const char*, int);
-
- void* operatorNew(size_t);
- void operatorDelete(void*);
-};
-
-}
-
-#endif
diff --git a/cpp/src/IceUtil/Makefile b/cpp/src/IceUtil/Makefile index 3a03a6029fb..6e07841987f 100644 --- a/cpp/src/IceUtil/Makefile +++ b/cpp/src/IceUtil/Makefile @@ -26,7 +26,6 @@ OBJS = Base64.o \ InputUtil.o \ MD5.o \ MD5I.o \ - MemoryPool.o \ Options.o \ OutputUtil.o \ RWRecMutex.o \ diff --git a/cpp/src/IceUtil/MemoryPool.cpp b/cpp/src/IceUtil/MemoryPool.cpp deleted file mode 100755 index aab2fcfba54..00000000000 --- a/cpp/src/IceUtil/MemoryPool.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include <IceUtil/MemoryPool.h> - -using namespace std; - -bool IceUtil::SimpleMemoryPool::_usePool = true; -int IceUtil::SimpleMemoryPool::_traceLevel = 0; - -IceUtil::SimpleMemoryPool::SimpleMemoryPool(const char* name, int num) : - _name(name), - _num(num), - _pool(0) -{ -} - -void* -IceUtil::SimpleMemoryPool::operatorNew(size_t sz) -{ - if(!_usePool) - { - return ::operator new(sz); - } - - sz = (sz + 7) & 0xffffff8U; - - if(_pool == 0 || *reinterpret_cast<void**>(_pool) == 0) - { - int total = 8 + sz; - char* p = reinterpret_cast<char*>(malloc(_num * total)); - - int i; - for(i = 0; i < _num - 1; ++i) - { - *reinterpret_cast<void**>(p + i * total) = p + (i + 1) * total; - } - *reinterpret_cast<void**>(p + i * total) = 0; - - if(_pool == 0) - { - _pool = p; - } - else - { - *reinterpret_cast<void**>(_pool) = p; - } - } - - void* result = reinterpret_cast<char*>(_pool) + 8; - _pool = *reinterpret_cast<void**>(_pool); - return result; -} - -void -IceUtil::SimpleMemoryPool::operatorDelete(void* p) -{ - if(!_usePool) - { - ::operator delete(p); - return; - } - - if(p == 0) - { - return; - } - - *reinterpret_cast<void**>(reinterpret_cast<char*>(p) - 8) = _pool; - _pool = reinterpret_cast<char*>(p) - 8; -} - -void -IceUtil::SimpleMemoryPool::usePool(bool b) -{ - _usePool = b; -} - -void -IceUtil::SimpleMemoryPool::traceLevel(int lvl) -{ - _traceLevel = lvl; -} - -IceUtil::MemoryPool::MemoryPool(const char* name, int num) : - SimpleMemoryPool(name, num) -{ -} - -void* -IceUtil::MemoryPool::operatorNew(size_t sz) -{ - if(!_usePool) - { - return ::operator new(sz); - } - - IceUtil::Mutex::Lock lock(*this); - return SimpleMemoryPool::operatorNew(sz); -} - -void -IceUtil::MemoryPool::operatorDelete(void* p) -{ - if(!_usePool) - { - ::operator delete(p); - return; - } - - IceUtil::Mutex::Lock lock(*this); - SimpleMemoryPool::operatorDelete(p); -} diff --git a/cpp/src/IceUtil/iceutil.dsp b/cpp/src/IceUtil/iceutil.dsp index d265ba417cd..90674773460 100644 --- a/cpp/src/IceUtil/iceutil.dsp +++ b/cpp/src/IceUtil/iceutil.dsp @@ -150,10 +150,6 @@ SOURCE=.\MD5I.cpp # End Source File
# Begin Source File
-SOURCE=.\MemoryPool.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\Options.cpp
# End Source File
# Begin Source File
@@ -270,10 +266,6 @@ SOURCE=MD5I.h # End Source File
# Begin Source File
-SOURCE=..\..\include\IceUtil\MemoryPool.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\include\iceutil\Monitor.h
# End Source File
# Begin Source File
|