Ember Connect API dynamically allocate and free memory. See Memory Buffer for documentation. More...

Macros

#define EMBER_NULL_BUFFER
 A special EmberBuffer ID indicating that no memory is currently allocated. More...
 

Handlers

void emberMarkApplicationBuffersHandler (void)
 This handler is invoked by the memory buffers system garbage collector and allows the application to properly mark the application-defined EmberBuffer variables. More...
 

APIs

EmberBuffer emberAllocateBuffer (uint16_t dataSizeInBytes)
 Dynamically allocates memory. More...
 
void emberMarkBuffer (EmberBuffer *buffer)
 Prevents the garbage collector from reclaiming the memory associated with the passed EmberBuffer. The application should call this API within the emberMarkApplicationBuffersHandler() stack handler for each EmberBuffer object. More...
 
uint8_t * emberGetBufferPointer (EmberBuffer buffer)
 Returns a pointer to the memory segment corresponding to the passed EmberBuffer buffer. Notice that the garbage collector can move memory segments to defragment the available memory. As result, the application should always use this API to obtain an updated pointer prior to accessing the memory. More...
 
uint16_t emberGetBufferLength (EmberBuffer buffer)
 Returns the length in bytes of the passed EmberBuffer buffer. More...
 
uint16_t emberGetAvailableBufferMemory (void)
 An API that returns the available memory at the buffer manager in bytes. More...
 

Detailed Description

Ember Connect API dynamically allocate and free memory. See Memory Buffer for documentation.

License

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

See memory-buffer.h for source code.

Macro Definition Documentation

#define EMBER_NULL_BUFFER

A special EmberBuffer ID indicating that no memory is currently allocated.

Definition at line 28 of file memory-buffer.h.

Function Documentation

EmberBuffer emberAllocateBuffer ( uint16_t  dataSizeInBytes)

Dynamically allocates memory.

Parameters
[in]dataSizeInBytesThe size in bytes of the memory to be allocated.
Returns
An EmberBuffer value of EMBER_NULL_BUFFER if the memory management system could not allocate the requested memory, or any other EmberBuffer value indicating that the requested memory was successfully allocated. The allocated memory can easily be freed by assigning an EmberBuffer variable to EMBER_NULL_BUFFER. The memory will be freed by the garbage collector during the next emberTick() call.
uint16_t emberGetAvailableBufferMemory ( void  )

An API that returns the available memory at the buffer manager in bytes.

Returns
The number of available bytes.
uint16_t emberGetBufferLength ( EmberBuffer  buffer)

Returns the length in bytes of the passed EmberBuffer buffer.

Parameters
[in]bufferA pointer to the EmberBuffer buffer for which the corresponding length in bytes should be returned.
Returns
The length in bytes of a memory segment corresponding to the passed EmberBuffer buffer.
uint8_t* emberGetBufferPointer ( EmberBuffer  buffer)

Returns a pointer to the memory segment corresponding to the passed EmberBuffer buffer. Notice that the garbage collector can move memory segments to defragment the available memory. As result, the application should always use this API to obtain an updated pointer prior to accessing the memory.

Parameters
[in]bufferA pointer to the EmberBuffer buffer for which the corresponding memory pointer should be returned.
Returns
A NULL pointer if the passed EmberBuffer value is EMBER_NULL_BUFFER. Otherwise, a pointer to the corresponding memory segment.
void emberMarkApplicationBuffersHandler ( void  )

This handler is invoked by the memory buffers system garbage collector and allows the application to properly mark the application-defined EmberBuffer variables.

void emberMarkBuffer ( EmberBuffer buffer)

Prevents the garbage collector from reclaiming the memory associated with the passed EmberBuffer. The application should call this API within the emberMarkApplicationBuffersHandler() stack handler for each EmberBuffer object.

Parameters
[in]bufferA pointer to the EmberBuffer buffer to be marked.