#include <buffers.h>
Public Methods | |
TVMemMgr () | |
Static Public Methods | |
void | resizeSafetyPool (size_t sz=DEFAULT_SAFETY_POOL_SIZE) |
int | safetyPoolExhausted () |
void | clearSafetyPool () |
void | allocateDiscardable (void *&adr, size_t sz) |
void | freeDiscardable (void *) |
void | suspend (void) |
In particular, TVMemMgr manages the safety pool. For most applications, TVMemMgr and TBufListEntry objects work behind the scenes without the need for specific programmer action or intervention.
Definition at line 88 of file buffers.h.
|
Constructor. Does nothing if the safety pool is already initialized (that is, if private data member inited = 1). Otherwise, calls method TVMemMgr::resizeSafetyPool to establish a default safety pool with the size given by the constant DEFAULT_SAFETY_POOL_SIZE. The latter is currently set to 4,096 (bytes) in `buffers.h'. The constructor also sets inited to 1. |
|
For internal use only. Tries to allocate a cache buffer (TBufListEntry object) of size `sz'. If successful, `adr' returns a pointer to the allocated buffer; otherwise, `adr' is set to 0. TGroup::getBuffer() calls allocateDiscardable() with `adr' set to the TGroup::buffer data member. |
|
Undocumented. |
|
For internal use only. Frees the buffer allocated at block by an earlier allocateDiscardable() call. TGroup::freeBuffer() calls freeDiscardable() with block set to the TGroup::buffer data member. |
|
Resizes the safety pool to `sz' bytes. The previous safety pool, if one exists, is freed first. inited private data member is set to 1, safetyPool is set to point to the new safety pool, and safetyPoolSize is set to `sz'. If the `sz' argument is omitted, the default value is assumed. If `sz' is 0, both safetyPool and safetyPoolSize private data members are set to 0. |
|
Returns 1 (True) if the safety pool is initialized and its allocation is exhausted. Otherwise, returns 0 (False). |
|
Undocumented. |