FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
memory Namespace Reference

Contains a few utility method to deal with free SRAM memory. More...

Functions

int free_mem ()
 Return the amount of free SRAM memory. More...
 
bool check_mem (int minimum)
 Check if current free SRAM memory is above the provided minimum. More...
 
void alert_mem (int minimum)
 Check if current free SRAM memory is above the provided minimum. More...
 

Detailed Description

Contains a few utility method to deal with free SRAM memory.

Function Documentation

◆ free_mem()

int memory::free_mem ( )

Return the amount of free SRAM memory.

Definition at line 40 of file memory.h.

◆ check_mem()

bool memory::check_mem ( int  minimum)

Check if current free SRAM memory is above the provided minimum.

This can be used to ensure the program has enough memory before a big allocation (dynamic or calling a function needing a big stack).

Parameters
minimumthe minimum amount of free memory required
Return values
trueif free memory is strictly above minimum
falseif free memory is below minimum

Definition at line 54 of file memory.h.

◆ alert_mem()

void memory::alert_mem ( int  minimum)

Check if current free SRAM memory is above the provided minimum.

In case free SRAM memory is under minimum, then the LED pin will be set, otherwise it will be cleared.

Parameters
minimumthe minimum amount of free memory required
See also
board::DigitalPin::LED

Definition at line 67 of file memory.h.