Adun  0.83
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Static Public Member Functions
AdMemoryManager Class Reference

#import <AdunMemoryManager.h>

List of all members.

Public Member Functions

(void *) - allocateArrayOfSize:
(void) - freeArray:
(void) - freeMatrix:
(void) - freeIntMatrix:
(AdMatrix *) - allocateMatrixWithRows:withColumns:
(IntMatrix *) - allocateIntMatrixWithRows:withColumns:

Static Public Member Functions

(id) + appMemoryManager

Detailed Description

AdMemoryManager provides memory allocation functionality to the framework. It creates ::AdMatrix and IntMatrix structures aswell as C arrays. AdMemoryManager must be used to free any structures it creates via its free methods.

AdMemoryManager is a singleton. Only one instance of it exists per simulation. Use appMemoryManager (AdMemoryManager) to return the simulations AdMemoryManager instance.

Defaults:

An applications AdMemoryManager instance will output statistics on each allocation/deallocation if a default called OutputMemoryStatistics exists in the applications default domain and it is set to YES.

Before and after each event the values (in MB's) returned by the libc function mallinfo() for arena, hblks, uordblks and fordbblks are written to stderr.


Member Function Documentation

- (void *) allocateArrayOfSize: (size_t)  size

Allocates an array of size size The elements of the array are set to 0

Parameters:
sizethe size of the array in bytes
- (IntMatrix *) allocateIntMatrixWithRows: (int)  no_rows
withColumns: (int)  no_columns 

Allocates an IntMatrix with the requseted dimensions. The

Parameters:
no_rowsThe number of rows in the matrix
no_columnsThe number of columns in the matrix
Returns:
A pointer to an IntMatrix struct which contain a reference to the allocated memory area The matrix contents are initialised to 0.
- (AdMatrix *) allocateMatrixWithRows: (int)  no_rows
withColumns: (int)  no_columns 

Allocates an ::AdMatrix with the requseted dimensions

Parameters:
no_rowsThe number of rows in the matrix
no_columnsThe number of columns in the matrix
Returns:
A pointer to a ::AdMatrix struct which contain a reference to the allocated memory area The matrix contents are initialised to 0.
+ (id) appMemoryManager

Returns the shared memory manager for the application.

- (void) freeArray: (void*)  array

Frees an array allocated with allocateArrayOfSize:

Parameters:
arrayA pointer to the first element of the array to be freed i.e. array[0]
- (void) freeIntMatrix: (IntMatrix*)  matrix

Frees an ::Intmatrix allocated with AdMemoryManager::allocateIntMatrixWithRows:withColumns

Parameters:
matrixa pointer to the IntMatrix struct
- (void) freeMatrix: (AdMatrix*)  matrix

Frees an ::AdMatrix allocated with AdMemoryManager::allocateMatrixWithRows:withColumns

Parameters:
matrixa pointer to the ::AdMatrix struct