NAME
OTC_CommonPool -
Common memory pool for small objects.
SYNOPSIS
#include <OTC/memory/cmmnpool.hh>
class OTC_CommonPool
{
public:
friend class OTC_CommonPoolDummy;
static void* allocate(size_t theSize);
static void release(void* theMem, size_t theSize);
};
CLASS TYPE
Static
DESCRIPTION
The class OTC_CommonPool is a common memory pool for small
objects.
Currently 8 pools are created, with the size of the pools
varying by sizeof(double). Thus, on 32 bit machines, there will
be pools ranging from 8 bytes to 64 bytes, with a 8 byte
difference in the size of each pool. If a piece of memory larger
than 64 bytes is requested, the global new and delete are
used.
All the pools can be disabled and the global new and delete
used for all memory, by defining the environment variable
OTCLIB_NOCOMMONPOOL.
ALLOCATION/DEALLOCATION
static void* allocate(size_t theSize);
Allocates and returns a piece of memory
of sufficient size to hold an object of
theSize.
static void release(void* theMem, size_t theSize);
Releases theMem. theSize should be
the same as the size used to originally
allocate the memory. If the memory was
not originally allocated from this
pool, the result is undefined.
NOTES
If a class overrides operator new() and operator delete()
to use this class will be derived from. The class must have a
virtual destructor.
SEE ALSO
OTC_Pool
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED