Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
// C++ for Arduino
// What is heap fragmentation?
#pragma once
#include <stddef.h> // for size_t
// Returns the number of free bytes in the RAM.
size_t getTotalAvailableMemory();
// Returns the size of the largest allocable block of RAM.
size_t getLargestAvailableBlock();
// Computes the heap fragmentation percentage.
inline float getFragmentation() {
return 100 - getLargestAvailableBlock() * 100.0 / getTotalAvailableMemory();