Memory API

Memory related APIs for ESP-NOW.

API Reference

Header File

Functions

void espnow_mem_add_record(void *ptr, int size, const char *tag, int line)

Add to memory record.

Parameters:
  • ptr[in] memory pointer

  • size[in] memory size

  • tag[in] description tag

  • line[in] line number

void espnow_mem_remove_record(void *ptr, const char *tag, int line)

Remove from memory record.

Parameters:
  • ptr[in] memory pointer

  • tag[in] description tag

  • line[in] line number

void espnow_mem_print_record(void)

Print the all allocation but not released memory.

Attention

Must configure CONFIG_ESPNOW_MEM_DEBUG == y annd esp_log_level_set(esp_mem, ESP_LOG_INFO);

void espnow_mem_print_heap(void)

Print memory and free space on the stack.

void espnow_mem_print_task(void)

Print the state of tasks in the system.

Macros

ESP_MEM_DEBUG

< _cplusplus CONFIG_ESPNOW_MEM_DEBUG

CONFIG_ESPNOW_MEM_DBG_INFO_MAX

CONFIG_ESPNOW_MEM_DBG_INFO_MAX

MEM_DBG_INFO_MAX
MALLOC_CAP_INDICATE
ESP_MALLOC(size)

Malloc memory.

Parameters:
  • size[in] memory size

Returns:

  • valid pointer on success

  • NULL when any errors

ESP_CALLOC(n, size)

Calloc memory.

Parameters:
  • n[in] number of block

  • size[in] block memory size

Returns:

  • valid pointer on success

  • NULL when any errors

ESP_REALLOC(ptr, size)

Reallocate memory.

Parameters:
  • ptr[in] memory pointer

  • size[in] block memory size

Returns:

  • valid pointer on success

  • NULL when any errors

ESP_REALLOC_RETRY(ptr, size)

Reallocate memory, If it fails, it will retry until it succeeds.

Parameters:
  • ptr[in] memory pointer

  • size[in] block memory size

Returns:

  • valid pointer on success

  • NULL when any errors

ESP_FREE(ptr)

Free memory.

Parameters:
  • ptr[in] memory pointer _cplusplus