RTI Connext C API Version 7.3.0

<<extension>> Heap allocation and free routines in C More...

Functions

void * DDS_Heap_calloc (size_t numElem, size_t size)
 Peforms the logical equivalent of calloc(). More...
 
void * DDS_Heap_malloc (size_t size)
 Peforms the logical equivalent of malloc(). More...
 
void DDS_Heap_free (void *ptr)
 Performs the logical equivalent of free(). More...
 

Detailed Description

<<extension>> Heap allocation and free routines in C

The functions in this class ensure consistent cross-platform implementations for memory allocation (DDS_Heap_malloc() and DDS_Heap_calloc()) and deletion (DDS_Heap_free()).

Applications need to use these routines to reserve memory that the middleware will release or to free memory that the middleware has allocated.

For example, to allocate an optional member in a sample use DDS_Heap_malloc()/ DDS_Heap_calloc(); to release an optional member previously reserved by FooTypeSupport_create_data_w_params(), use DDS_Heap_free().

Function Documentation

◆ DDS_Heap_calloc()

void * DDS_Heap_calloc ( size_t  numElem,
size_t  size 
)

Peforms the logical equivalent of calloc().

Allocates unused space for an array with numElem elements each of whose size in bytes is size. The memory will be initialized to zeros.

Parameters
numElem<<in>> The number of elements in the array to be allocated
size<<in>> The size in bytes of each element in the array
Returns
If insufficient memory is available, this function will return NULL. Otherwise, upon success it returns a pointer to the allocated space.

◆ DDS_Heap_malloc()

void * DDS_Heap_malloc ( size_t  size)

Peforms the logical equivalent of malloc().

Allocates unused space for an object of the specified size. The memory will be initialized to zeros.

Parameters
size<<in>> The size in bytes of the object to be allocated
Returns
If insufficient memory is available, this function will return NULL. Otherwise, upon success it returns a pointer to the allocated space.

◆ DDS_Heap_free()

void DDS_Heap_free ( void *  ptr)

Performs the logical equivalent of free().

Deallocates the space pointed to by ptr and made available for further allocation.

Parameters
ptr<<in>> A pointer to the space to be deallocated