Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TVMemMgr Class Reference

Part of the memory manager. More...

#include <buffers.h>

List of all members.

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)


Detailed Description

TVMemMgr, in conjunction with TBufListEntry and the global operator new, provides low-level memory management for TVision applications.

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 & Destructor Documentation

TVMemMgr::TVMemMgr ( )
 

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.


Member Function Documentation

void TVMemMgr::allocateDiscardable ( void *& adr,
size_t sz ) [static]
 

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.

void TVMemMgr::clearSafetyPool ( ) [static]
 

Undocumented.

void TVMemMgr::freeDiscardable ( void * ) [static]
 

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.

void TVMemMgr::resizeSafetyPool ( size_t sz = DEFAULT_SAFETY_POOL_SIZE ) [static]
 

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.

int TVMemMgr::safetyPoolExhausted ( ) [static]
 

Returns 1 (True) if the safety pool is initialized and its allocation is exhausted. Otherwise, returns 0 (False).

void TVMemMgr::suspend ( void ) [static]
 

Undocumented.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:39 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001