Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

nvutil::Allocator Class Reference

Internal manager for memory allocations. More...

#include <Allocator.h>

Collaboration diagram for nvutil::Allocator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Allocator ()
 Default constructor.
 ~Allocator ()
 Destructor.
void * alloc (size_t size)
 Allocate continuous memory of size size.
void dealloc (void *p, size_t size)
 Deallocate previously allocated memory.

Detailed Description

Internal manager for memory allocations.

This class is used as a Singleton by IAllocator, which is the base of all RCObject classes. It manages the efficient allocation of small objects by using an array of FixedAllocator objects, one for each small size up to maxBlockSize. Allocations larger than that size are redirected to the standard allocation ::new.


Constructor & Destructor Documentation

nvutil::Allocator::Allocator  ) 
 

Default constructor.

Initializes the array of FixedAllocator objects.

nvutil::Allocator::~Allocator  ) 
 

Destructor.

In debug mode warnings on not deleted objects are emitted.


Member Function Documentation

void * nvutil::Allocator::alloc size_t  size  )  [inline]
 

Allocate continuous memory of size size.

Forwards either to the FixedAllocator of the specified size, or to the global new operator.

Parameters:
size  size of memory to allocate

void nvutil::Allocator::dealloc void *  p,
size_t  size
[inline]
 

Deallocate previously allocated memory.

Forwards either to the FixedAllocator of the specified size, or to the global delete operator. In debug mode, the corresponding information stored by alloc is erased.

Parameters:
p  pointer to the memory to deallocate
size  size of the allocated memory


The documentation for this class was generated from the following file:
Generated on Tue Mar 1 13:21:12 2005 for NVSGSDK by NVIDIA