Struct desfire::esp32::mem_monitor

Struct Documentation

struct mem_monitor

Utility class that snapshots heap memory and checks if there is any leak.

Note

You must have CONFIG_HEAP_TRACING defined in your ESP32 configuration for this to work.

Non-copiable, non-moveable

mem_monitor(mem_monitor&&) noexcept = delete
mem_monitor(mem_monitor const&) = delete
mem_monitor &operator=(mem_monitor&&) noexcept = delete
mem_monitor &operator=(mem_monitor const&) = delete

Public Functions

mem_monitor()

Initializes the memory monitor with heap_trace_init_standalone and heap_trace_start.

~mem_monitor()

Stops heap tracing with heap_trace_stop and unhooks this class from ESP32’s heap tracing system.

std::size_t count_leaked_memory() const

Returns the amount of memory leaked in bytes.

Returns:

A number, always 0 if CONFIG_HEAP_TRACING is disabled.