Google Cloud IoT device SDK for embedded C  1.0.2
iotc_bsp_mem.h File Reference

Go to the source code of this file.

Functions

void * iotc_bsp_mem_alloc (size_t byte_count)
 
void * iotc_bsp_mem_realloc (void *ptr, size_t byte_count)
 
void iotc_bsp_mem_free (void *ptr)
 

Detailed Description

Manages platform memory.

For instance, custom implementations can use static instead of heap memory.

Definition in file iotc_bsp_mem.h.

Function Documentation

◆ iotc_bsp_mem_alloc()

void* iotc_bsp_mem_alloc ( size_t  byte_count)

Allocates memory and returns a pointer to the allocated block.

Parameters
[in]byte_countThe number of bytes to allocate.

◆ iotc_bsp_mem_free()

void iotc_bsp_mem_free ( void *  ptr)

Frees a block of memory.

Parameters
[in]ptrA pointer to a memory block to free.

◆ iotc_bsp_mem_realloc()

void* iotc_bsp_mem_realloc ( void *  ptr,
size_t  byte_count 
)

Changes the size of a memory block and returns a pointer to the reallocated block.

If the new memory block size is smaller than the old memory block, the SDK saves the maximum amount of memory, even if the block moves to a new location. If the new size is larger, the SDK leaves the leftover memory empty.

This function is a convenience function that you don't need to implement. You can also reallocate memory with the iotc_bsp_mem_alloc() and and iotc_bsp_mem_free() functions.

Parameters
[in]ptrA pointer to a memory block to reallocate.
[in]btye_countThe new size, in bytes, of the memory block.